summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2020-03-11 21:49:38 +0100
committerMarius Bakke <mbakke@fastmail.com>2020-03-11 22:43:44 +0100
commit7815afc9580f8a1bcadc064d0a62db2ad176e1e9 (patch)
tree677d6d6ec37f504e9b6420112ac8a148e45e2887 /gnu
parentebd4c251780c29c6d0190e56b99462f93bf85c4b (diff)
downloadguix-7815afc9580f8a1bcadc064d0a62db2ad176e1e9.tar.gz
gnu: python2-virtualenv: Fix build.
* gnu/packages/python-xyz.scm (python-virtualenv)[properties]: New field.
(python2-virtualenv)[propagated-inputs]: Add PYTHON2-CONTEXTLIB2.
[arguments]: New field.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/python-xyz.scm31
1 files changed, 30 insertions, 1 deletions
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index d14d60693a..af2bb43169 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -2426,10 +2426,39 @@ e.g. filters, callbacks and errbacks can all be promises.")
     (synopsis "Virtual Python environment builder")
     (description
      "Virtualenv is a tool to create isolated Python environments.")
+    (properties `((python2-variant . ,(delay python2-virtualenv))))
     (license license:expat)))
 
 (define-public python2-virtualenv
-  (package-with-python2 python-virtualenv))
+  (let ((base (package-with-python2 (strip-python2-variant python-virtualenv))))
+    (package
+      (inherit base)
+      (arguments
+       `(#:python ,python-2
+         #:phases
+         (modify-phases %standard-phases
+           (add-after 'set-paths 'adjust-PYTHONPATH
+             (lambda* (#:key inputs #:allow-other-keys)
+               (let* ((python (assoc-ref inputs "python"))
+                      (python-sitedir (string-append python "/lib/python2.7"
+                                                     "/site-packages")))
+                 ;; XXX: 'python2' always comes first on PYTHONPATH
+                 ;; and shadows the 'setuptools' input.  Move python2
+                 ;; last: this should be fixed in python-build-system
+                 ;; in a future rebuild cycle.
+                 (setenv "PYTHONPATH"
+                         (string-append (string-join (delete python-sitedir
+                                                             (string-split
+                                                              (getenv "PYTHONPATH")
+                                                              #\:))
+                                                     ":")
+                                        ":" python-sitedir))
+                 (format #t "environment variable `PYTHONPATH' changed to `~a'~%"
+                         (getenv "PYTHONPATH"))
+                 #t))))))
+      (propagated-inputs
+       `(("python-contextlib2" ,python2-contextlib2)
+         ,@(package-propagated-inputs base))))))
 
 (define-public python-markupsafe
   (package