diff mbox series

[bug#64573,2/3] gnu: python-pip: Enable user site even with PYTHONNOUSERSITE

Message ID 6165ff7042c6d1269a471924e7e383be04f6c0da.1689093931.git.koszko@koszko.org
State New
Headers show
Series guix: build: python-build-system: Have applications by default ignore non-Guix libraries in user site dir | expand

Commit Message

Wojtek Kosior July 11, 2023, 6:14 p.m. UTC
* gnu/packages/python-build.scm (python-pip): Patch pip to allow installing to
user site dir when PYTHONNOUSERSITE is set by Guix wrapper script to
'GUIX_WRAPPER' string.
---
 gnu/packages/python-build.scm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/gnu/packages/python-build.scm b/gnu/packages/python-build.scm
index 154c97e9e4..54d12f3fdc 100644
--- a/gnu/packages/python-build.scm
+++ b/gnu/packages/python-build.scm
@@ -269,7 +269,15 @@  (define-public python-pip
          "0jnk639v9h7ghslm4jnlic6rj3v29nygflx1hgxxndg5gs4kk1a0"))))
     (build-system python-build-system)
     (arguments
-     '(#:tests? #f))          ; there are no tests in the pypi archive.
+     `(#:tests? #f            ;there are no tests in the pypi archive
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'allow-installing-to-user-site
+           (lambda _
+             (substitute* "src/pip/_internal/commands/install.py"
+               (("( *if not site\\.ENABLE_USER_SITE):" match if-clause)
+                (string-append if-clause
+                               " and not os.environ['PYTHONNOUSERSITE'] == 'GUIX_WRAPPER':"))))))))
     (home-page "https://pip.pypa.io/")
     (synopsis "Package manager for Python software")
     (description