2021-01-09 10:05:03 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
2024-04-21 15:54:59 +00:00
|
|
|
, fetchpatch
|
2020-04-24 23:36:52 +00:00
|
|
|
, isPyPy
|
|
|
|
, R
|
|
|
|
, rWrapper
|
|
|
|
, rPackages
|
|
|
|
, pcre
|
2021-04-05 15:23:46 +00:00
|
|
|
, xz
|
2020-04-24 23:36:52 +00:00
|
|
|
, bzip2
|
|
|
|
, zlib
|
|
|
|
, icu
|
|
|
|
, ipython
|
|
|
|
, jinja2
|
|
|
|
, pytz
|
|
|
|
, pandas
|
|
|
|
, numpy
|
|
|
|
, cffi
|
|
|
|
, tzlocal
|
|
|
|
, simplegeneric
|
2021-01-09 10:05:03 +00:00
|
|
|
, pytestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
, extraRPackages ? []
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "3.5.16";
|
2024-01-02 11:29:13 +00:00
|
|
|
format = "setuptools";
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "rpy2";
|
|
|
|
|
|
|
|
disabled = isPyPy;
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit version pname;
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-g34vdFg2WKXEwzl2GnP5Q08z75ztPjDGTadWIWXCgBs=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-01-09 10:05:03 +00:00
|
|
|
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' ""
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildInputs = [
|
|
|
|
pcre
|
2021-04-05 15:23:46 +00:00
|
|
|
xz
|
2020-04-24 23:36:52 +00:00
|
|
|
bzip2
|
|
|
|
zlib
|
|
|
|
icu
|
|
|
|
] ++ (with rPackages; [
|
|
|
|
# packages expected by the test framework
|
|
|
|
ggplot2
|
|
|
|
dplyr
|
|
|
|
RSQLite
|
|
|
|
broom
|
|
|
|
DBI
|
|
|
|
dbplyr
|
|
|
|
hexbin
|
2020-11-24 20:58:05 +00:00
|
|
|
lazyeval
|
2020-04-24 23:36:52 +00:00
|
|
|
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
|
|
|
|
];
|
|
|
|
|
2021-01-09 10:05:03 +00:00
|
|
|
doCheck = !stdenv.isDarwin;
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-01-09 10:05:03 +00:00
|
|
|
pytestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
meta = {
|
2020-11-24 20:58:05 +00:00
|
|
|
homepage = "https://rpy2.github.io/";
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Python interface to R";
|
|
|
|
license = lib.licenses.gpl2Plus;
|
|
|
|
platforms = lib.platforms.unix;
|
|
|
|
maintainers = with lib.maintainers; [ joelmo ];
|
|
|
|
};
|
|
|
|
}
|