diff options
author | Andreas Enge <andreas@enge.fr> | 2013-09-11 15:47:34 +0200 |
---|---|---|
committer | Andreas Enge <andreas@enge.fr> | 2013-09-11 15:47:34 +0200 |
commit | 824af8cadc1b4f1ac7a859f3d18cbe69b195a844 (patch) | |
tree | cf78b791710c0454ccc8e5759524c6c9d956bf6e /guix | |
parent | 73adf220370e12b8788d47ea22ee1975cb9bc752 (diff) | |
download | gnu-guix-824af8cadc1b4f1ac7a859f3d18cbe69b195a844.tar gnu-guix-824af8cadc1b4f1ac7a859f3d18cbe69b195a844.tar.gz |
guix: python: Create module installation path and add it to PYTHONPATH during
the installation phase.
* guix/build/python-build-system.scm (get-python-version): New procedure.
* guix/build/python-build-system.scm (install): Create and add path.
* gnu/packages/python.scm (python-setuptools): Drop path creation code.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/build/python-build-system.scm | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm index f213a97f01..0bb8c4d49d 100644 --- a/guix/build/python-build-system.scm +++ b/guix/build/python-build-system.scm @@ -54,12 +54,27 @@ (call-setuppy test-target '()) #t)) -(define* (install #:key outputs (configure-flags '()) +(define (get-python-version python) + (string-take (string-take-right python 5) 3)) + +(define* (install #:key outputs inputs (configure-flags '()) #:allow-other-keys) "Install a given Python package." (let* ((out (assoc-ref outputs "out")) (params (append (list (string-append "--prefix=" out)) - configure-flags))) + configure-flags)) + (python-version (get-python-version (assoc-ref inputs "python"))) + (old-path (getenv "PYTHONPATH")) + (add-path (string-append out "/lib/python" python-version + "/site-packages/"))) + ;; create the module installation directory and add it to PYTHONPATH + ;; to make setuptools happy + (mkdir-p add-path) + (setenv "PYTHONPATH" + (string-append (if old-path + (string-append old-path ":") + "") + add-path)) (call-setuppy "install" params))) (define* (wrap #:key inputs outputs #:allow-other-keys) @@ -79,10 +94,10 @@ (let* ((out (assoc-ref outputs "out")) (python (assoc-ref inputs "python")) - (python-version (string-take (string-take-right python 5) 3)) (var `("PYTHONPATH" prefix ,(cons (string-append out "/lib/python" - python-version "/site-packages") + (get-python-version python) + "/site-packages") (search-path-as-string->list (or (getenv "PYTHONPATH") "")))))) (for-each (lambda (dir) |