>From e9fdaec83568d14b5462757b473ed6f25b3f114e Mon Sep 17 00:00:00 2001 From: Caleb Ristvedt Date: Tue, 8 Jan 2019 01:26:59 -0600 Subject: [PATCH] patches: honor NIX_STORE in site.py. Previously various python packages would fail to work unless the store they were kept in was /gnu/store. This fixes that. * gnu/packages/patches/python-2.7-site-prefixes.patch: Try NIX_STORE first and only use /gnu/store as a fallback. --- gnu/packages/patches/python-2.7-site-prefixes.patch | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gnu/packages/patches/python-2.7-site-prefixes.patch b/gnu/packages/patches/python-2.7-site-prefixes.patch index 9e3066508..0451d07f4 100644 --- a/gnu/packages/patches/python-2.7-site-prefixes.patch +++ b/gnu/packages/patches/python-2.7-site-prefixes.patch @@ -5,7 +5,7 @@ site-packages (and .pth files) are searched. --- Python-2.7.11/Lib/site.py 2016-10-17 23:44:51.930871644 +0200 *************** *** 65,70 **** ---- 65,82 ---- +--- 65,85 ---- # Prefixes for site-packages; add additional prefixes like /usr/local here PREFIXES = [sys.prefix, sys.exec_prefix] @@ -16,9 +16,12 @@ site-packages (and .pth files) are searched. + # This is necessary if the packages are not merged into a single + # `site-packages` directory (like when using `guix environment`) but + # listed in PYTHONPATH (like when running `guix build`). ++ guix_store = os.getenv("NIX_STORE") ++ if not guix_store: ++ guix_store = '/gnu/store' + for p in sys.path: -+ if p.startswith('/gnu/store/'): -+ PREFIXES.append(p[:p.find('/', 44)]) # find first pathsep after hash ++ if p.startswith(guix_store): ++ PREFIXES.append(p[:p.find('/', 34 + len(guix_store))]) # find first pathsep after hash + del p + # Enable per user site-packages directory -- 2.20.0