GNU bug report logs -
#64573
[PATCH 0/3] guix: build: python-build-system: Have applications by default ignore non-Guix libraries in user site dir
Previous Next
Reported by: Wojtek Kosior <koszko <at> koszko.org>
Date: Tue, 11 Jul 2023 18:13:01 UTC
Severity: normal
Tags: patch
Done: Wojtek Kosior <koszko <at> koszko.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
* guix/build/python-build-system.scm (wrap): Define PYTHONNOUSERSITE for
programs so they don't incorrectly pick up local, pip-installed libraries.
---
guix/build/python-build-system.scm | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm
index aa04664b25..93aafc4aa9 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -241,12 +241,16 @@ (define* (wrap #:key inputs outputs #:allow-other-keys)
(define %sh (delay (search-input-file inputs "bin/bash")))
(define (sh) (force %sh))
- (let* ((var `("GUIX_PYTHONPATH" prefix
- ,(search-path-as-string->list
- (or (getenv "GUIX_PYTHONPATH") "")))))
+ (let* ((var-pythonpath `("GUIX_PYTHONPATH" prefix
+ ,(search-path-as-string->list
+ (or (getenv "GUIX_PYTHONPATH") ""))))
+ ;; Harden applications by preventing Python from automatically
+ ;; picking up libraries in user site directory.
+ (var-usersite '("PYTHONNOUSERSITE" = ("GUIX_WRAPPER"))))
(for-each (lambda (dir)
(let ((files (list-of-files dir)))
- (for-each (cut wrap-program <> #:sh (sh) var)
+ (for-each (cut wrap-program <> #:sh (sh)
+ var-pythonpath var-usersite)
files)))
bindirs)))
--
2.40.1
This bug report was last modified 1 year and 301 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.