depot/third_party/nixpkgs/pkgs/development/python-modules/rpy2/rpy2-3.x-r-libs-site.patch
Default email 8ac5e011d6 Project import generated by Copybara.
GitOrigin-RevId: 2c3273caa153ee8eb5786bc8141b85b859e7efd7
2020-04-24 19:36:52 -04:00

21 lines
802 B
Diff

diff --git a/rpy2/rinterface_lib/embedded.py b/rpy2/rinterface_lib/embedded.py
index cc32b6d..3969ad0 100644
--- a/rpy2/rinterface_lib/embedded.py
+++ b/rpy2/rinterface_lib/embedded.py
@@ -113,6 +113,16 @@ def _initr(interactive: bool = True,
if isinitialized():
return None
os.environ['R_HOME'] = openrlib.R_HOME
+
+ # 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)