Commit def73670 authored by Mauricio Collares's avatar Mauricio Collares
Browse files

python313Packages.rpy2: 3.6.2 -> 3.6.3, unbreak

parent dd86eded
Loading
Loading
Loading
Loading
+9 −77
Original line number Diff line number Diff line
@@ -4,99 +4,31 @@
  buildPythonPackage,
  fetchPypi,
  isPyPy,
  R,
  libdeflate,
  rWrapper,
  rPackages,
  pcre,
  xz,
  bzip2,
  zlib,
  zstd,
  icu,
  ipython,
  jinja2,
  pytz,
  pandas,
  numpy,
  cffi,
  tzlocal,
  simplegeneric,
  rpy2-rinterface,
  rpy2-robjects,
  pytestCheckHook,
  extraRPackages ? [ ],
}:

buildPythonPackage rec {
  version = "3.6.2";
  format = "setuptools";
  version = "3.6.3";
  format = "pyproject";
  pname = "rpy2";

  disabled = isPyPy;
  src = fetchPypi {
    inherit version pname;
    hash = "sha256-F06ld2qR0Ds13VYRiJlg4PVFHp0KvqSr/IwL5qhTd9A=";
    hash = "sha256-lCYYoSUhljAG0i6IqqTUgakjghwDoXQsmb7uci6w/Fo=";
  };

  patches = [
    # R_LIBS_SITE is used by the nix r package to point to the installed R libraries.
    # This patch sets R_LIBS_SITE when rpy2 is imported.
    ./rpy2-3.x-r-libs-site.patch
  ];

  postPatch = ''
    substituteInPlace 'rpy2/rinterface_lib/embedded.py' --replace '@NIX_R_LIBS_SITE@' "$R_LIBS_SITE"
    substituteInPlace 'requirements.txt' --replace 'pytest' ""
  '';

  buildInputs = [
    pcre
    xz
    bzip2
    zlib
    zstd
    icu
    libdeflate
  ]
  ++ (with rPackages; [
    # packages expected by the test framework
    ggplot2
    dplyr
    RSQLite
    broom
    DBI
    dbplyr
    hexbin
    lazyeval
    lme4
    tidyr
  ])
  ++ extraRPackages
  ++ rWrapper.recommendedPackages;

  nativeBuildInputs = [
    R # needed at setup time to detect R_HOME (alternatively set R_HOME explicitly)
  ];

  propagatedBuildInputs = [
    ipython
    jinja2
    pytz
    pandas
    numpy
    cffi
    tzlocal
    simplegeneric
    rpy2-rinterface
    rpy2-robjects
  ];

  # https://github.com/rpy2/rpy2/issues/1111
  disabledTests = [
    "test_parse_incomplete_error"
    "test_parse_error"
    "test_parse_error_when_evaluting"
  pythonImportsCheck = [
    "rpy2"
  ];

  nativeCheckInputs = [ pytestCheckHook ];

  meta = {
    homepage = "https://rpy2.github.io/";
    description = "Python interface to R";
+0 −21
Original line number Diff line number Diff line
diff --git a/rpy2/rinterface_lib/embedded.py b/rpy2/rinterface_lib/embedded.py
index ccd3a315..51fb5da4 100644
--- a/rpy2/rinterface_lib/embedded.py
+++ b/rpy2/rinterface_lib/embedded.py
@@ -276,6 +276,16 @@ def _initr(
                  os.environ.get('LD_LIBRARY_PATH', ''))
                 )
         )
+
+        # path to libraries
+        existing = os.environ.get('R_LIBS_SITE')
+        if existing is not None:
+            prefix = existing + ':'
+        else:
+            prefix = ''
+        additional = '@NIX_R_LIBS_SITE@'
+        os.environ['R_LIBS_SITE'] = prefix + additional
+
         options_c = [ffi.new('char[]', o.encode('ASCII')) for o in _options]
         n_options = len(options_c)
         n_options_c = ffi.cast('int', n_options)
+1 −1
Original line number Diff line number Diff line
@@ -16111,7 +16111,7 @@ self: super: with self; {
  rpmfluff = callPackage ../development/python-modules/rpmfluff { };
  rpy2 = callPackage ../development/python-modules/rpy2 { inherit (pkgs) zstd; };
  rpy2 = callPackage ../development/python-modules/rpy2 { };
  rpy2-rinterface = callPackage ../development/python-modules/rpy2-rinterface {
    inherit (pkgs) zstd;