Commit | Line | Data |
---|---|---|
15e57f57 HG |
1 | Add all /gnu/store/ prefixes found in PYTHONPATH to the prefixes where |
2 | site-packages (and .pth files) are searched. | |
3 | ||
4 | *** Python-2.7.11/Lib/site.py.orig 2016-10-17 23:27:23.746149690 +0200 | |
5 | --- Python-2.7.11/Lib/site.py 2016-10-17 23:44:51.930871644 +0200 | |
6 | *************** | |
7 | *** 65,70 **** | |
8 | --- 65,82 ---- | |
9 | ||
10 | # Prefixes for site-packages; add additional prefixes like /usr/local here | |
11 | PREFIXES = [sys.prefix, sys.exec_prefix] | |
12 | + # Guix: Add all /gnu/store-paths in PYTHONPATH--these are all | |
13 | + # "prefixes". This is required to search .pth files in all python | |
14 | + # packages contained in /gnu/store which is required to make | |
15 | + # .pth-defined namespace packages work. | |
16 | + # This is necessary if the packages are not merged into a single | |
17 | + # `site-packages` directory (like when using `guix environment`) but | |
18 | + # listed in PYTHONPATH (like when running `guix build`). | |
19 | + for p in sys.path: | |
20 | + if p.startswith('/gnu/store/'): | |
21 | + PREFIXES.append(p[:p.find('/', 44)]) # find first pathsep after hash | |
22 | + del p | |
23 | + | |
24 | # Enable per user site-packages directory | |
25 | # set it to False to disable the feature or True to force the feature | |
26 | ENABLE_USER_SITE = None |