diff options
author | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2022-01-17 10:07:35 -0500 |
---|---|---|
committer | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2022-01-17 11:47:09 -0500 |
commit | 276f40fdc349d2ad62582b23ea55e061b689cfc0 (patch) | |
tree | 8052d91aee78cf0d4317b41ec52134fde48fa5fb /gnu/packages/aux-files | |
parent | b2f6b6f6b9df6bcc24794238e7e97357470af95d (diff) | |
parent | 6ba510d76d6847065be725e958718002f3b13c7a (diff) | |
download | guix-276f40fdc349d2ad62582b23ea55e061b689cfc0.tar.gz |
Merge branch 'version-1.4.0'
With resolved conflicts in: gnu/packages/gnome.scm gnu/packages/openstack.scm gnu/packages/python-xyz.scm
Diffstat (limited to 'gnu/packages/aux-files')
-rw-r--r-- | gnu/packages/aux-files/python/sanity-check.py | 2 | ||||
-rw-r--r-- | gnu/packages/aux-files/python/sitecustomize.py | 22 |
2 files changed, 17 insertions, 7 deletions
diff --git a/gnu/packages/aux-files/python/sanity-check.py b/gnu/packages/aux-files/python/sanity-check.py index a84f8f03c0..182133bb3d 100644 --- a/gnu/packages/aux-files/python/sanity-check.py +++ b/gnu/packages/aux-files/python/sanity-check.py @@ -44,7 +44,7 @@ for dist in ws: pkg_resources.require(req) print('OK') except Exception as e: - print('ERROR:', req, e) + print('ERROR:', req, repr(e)) ret = 1 continue diff --git a/gnu/packages/aux-files/python/sitecustomize.py b/gnu/packages/aux-files/python/sitecustomize.py index 71e328b9ac..e2348e0356 100644 --- a/gnu/packages/aux-files/python/sitecustomize.py +++ b/gnu/packages/aux-files/python/sitecustomize.py @@ -18,6 +18,7 @@ # along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. import os +import site import sys # Commentary: @@ -47,9 +48,18 @@ all_sites_norm = [os.path.normpath(p) for p in all_sites_raw] matching_sites = [p for p in all_sites_norm if p.endswith(site_packages_prefix)] -# Insert sites matching the current version into sys.path, right before -# Python's own site. This way, the user can override the libraries provided -# by Python itself. -sys_path_absolute = [os.path.realpath(p) for p in sys.path] -index = sys_path_absolute.index(python_site) -sys.path[index:index] = matching_sites +if matching_sites: + # Deduplicate the entries, append them to sys.path, and handle any + # .pth files they contain. + for s in matching_sites: + site.addsitedir(s) + + # Move the entries that were appended to sys.path in front of + # Python's own site-packages directory. This enables Guix + # packages to override Python's bundled packages, such as 'pip'. + python_site_index = sys.path.index(python_site) + new_site_start_index = sys.path.index(matching_sites[0]) + if python_site_index < new_site_start_index: + sys.path = (sys.path[:python_site_index] + + sys.path[new_site_start_index:] + + sys.path[python_site_index:new_site_start_index]) |