aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages
diff options
context:
space:
mode:
authorHartmut Goebel <h.goebel@crazy-compilers.com>2016-10-18 00:11:05 +0200
committerHartmut Goebel <h.goebel@crazy-compilers.com>2016-11-15 17:37:48 +0100
commit15e57f576291d9233ab25e1614c6218579db170a (patch)
tree06fa50b60246fa93a7b18b52fe3dcbd633515fb0 /gnu/packages
parentc1019287a4aab55ebffab4710b9a85b6c9f1b7ed (diff)
downloadguix-15e57f576291d9233ab25e1614c6218579db170a.tar
guix-15e57f576291d9233ab25e1614c6218579db170a.tar.gz
gnu: python-2.7: Add all guix prefixes in PYTHONPATH to site-prefixes.
* gnu/packages/patches/python-2.7-site-prefixes.patch: New file. * gnu/packages/python.scm (python-2)[source]: Use it. * gnu/local.mk (dist_patch_DATA): Add patch.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/patches/python-2.7-site-prefixes.patch26
-rw-r--r--gnu/packages/python.scm1
2 files changed, 27 insertions, 0 deletions
diff --git a/gnu/packages/patches/python-2.7-site-prefixes.patch b/gnu/packages/patches/python-2.7-site-prefixes.patch
new file mode 100644
index 0000000000..9e3066508f
--- /dev/null
+++ b/gnu/packages/patches/python-2.7-site-prefixes.patch
@@ -0,0 +1,26 @@
+Add all /gnu/store/ prefixes found in PYTHONPATH to the prefixes where
+site-packages (and .pth files) are searched.
+
+*** Python-2.7.11/Lib/site.py.orig 2016-10-17 23:27:23.746149690 +0200
+--- Python-2.7.11/Lib/site.py 2016-10-17 23:44:51.930871644 +0200
+***************
+*** 65,70 ****
+--- 65,82 ----
+
+ # Prefixes for site-packages; add additional prefixes like /usr/local here
+ PREFIXES = [sys.prefix, sys.exec_prefix]
++ # Guix: Add all /gnu/store-paths in PYTHONPATH--these are all
++ # "prefixes". This is required to search .pth files in all python
++ # packages contained in /gnu/store which is required to make
++ # .pth-defined namespace packages work.
++ # 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`).
++ for p in sys.path:
++ if p.startswith('/gnu/store/'):
++ PREFIXES.append(p[:p.find('/', 44)]) # find first pathsep after hash
++ del p
++
+ # Enable per user site-packages directory
+ # set it to False to disable the feature or True to force the feature
+ ENABLE_USER_SITE = None
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index b6aeb8c032..ca40fe8c29 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -122,6 +122,7 @@
"0y7rl603vmwlxm6ilkhc51rx2mfj14ckcz40xxgs0ljnvlhp30yp"))
(patches (search-patches "python-2.7-search-paths.patch"
"python-2-deterministic-build-info.patch"
+ "python-2.7-site-prefixes.patch"
"python-2.7-source-date-epoch.patch"))
(modules '((guix build utils)))
;; suboptimal to delete failing tests here, but if we delete them in the