1{ 2 stdenv, 3 lib, 4 buildPythonPackage, 5 fetchurl, 6 isPyPy, 7 R, 8 rWrapper, 9 xz, 10 bzip2, 11 zlib, 12 zstd, 13 icu, 14 pytestCheckHook, 15 setuptools, 16 cffi, 17}: 18 19buildPythonPackage rec { 20 version = "3.6.3"; 21 format = "pyproject"; 22 pname = "rpy2-rinterface"; 23 24 disabled = isPyPy; 25 src = fetchurl { 26 url = "mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${ 27 builtins.replaceStrings [ "-" ] [ "_" ] pname 28 }-${version}.tar.gz"; 29 hash = "sha256-R3vC9R0AetG4VnxdS6GvD1mVFobufxBXagbQg03ld28="; 30 }; 31 32 patches = [ 33 # https://github.com/rpy2/rpy2/pull/1171#issuecomment-3263994962 34 ./restore-initr-simple.patch 35 36 # R_LIBS_SITE is used by the nix r package to point to the installed R libraries. 37 # This patch sets R_LIBS_SITE when rpy2 is imported. 38 ./rpy2-3.x-r-libs-site.patch 39 ]; 40 41 postPatch = '' 42 substituteInPlace 'src/rpy2/rinterface_lib/embedded.py' --replace '@NIX_R_LIBS_SITE@' "$R_LIBS_SITE" 43 ''; 44 45 buildInputs = [ 46 xz 47 bzip2 48 zlib 49 zstd 50 icu 51 ] 52 ++ rWrapper.recommendedPackages; 53 54 nativeBuildInputs = [ 55 R # needed at setup time to detect R_HOME (alternatively set R_HOME explicitly) 56 ]; 57 58 propagatedBuildInputs = [ 59 cffi 60 setuptools 61 ]; 62 63 nativeCheckInputs = [ pytestCheckHook ]; 64 65 # https://github.com/rpy2/rpy2/issues/1111 66 disabledTests = [ 67 "test_parse_incomplete_error" 68 "test_parse_error" 69 "test_parse_error_when_evaluting" 70 ]; 71 72 meta = { 73 homepage = "https://rpy2.github.io/"; 74 description = "Python interface to R"; 75 license = lib.licenses.gpl2Plus; 76 platforms = lib.platforms.unix; 77 maintainers = with lib; [ teams.sage ]; 78 }; 79}