diff options
author | Hartmut Goebel <h.goebel@crazy-compilers.com> | 2016-10-08 12:04:20 +0200 |
---|---|---|
committer | Hartmut Goebel <h.goebel@crazy-compilers.com> | 2016-11-15 17:37:45 +0100 |
commit | a2ff4f0240f0fac484836bb8ffb2f86917369666 (patch) | |
tree | a77902fed5ca1ebfc2c607bb7da9045e93dcc522 | |
parent | 5f7565d190cf380b7bae2ce12dba38aff98c4eb9 (diff) | |
download | guix-a2ff4f0240f0fac484836bb8ffb2f86917369666.tar.gz |
guix: python-build-system: Add helpers for getting and setting PYTHONPATH.
* guix/build/python-build-system.scm (add-installed-pythonpath, site-packages): New exported procedures.
-rw-r--r-- | guix/build/python-build-system.scm | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm index 7ccc9386cf..22c4f7d38a 100644 --- a/guix/build/python-build-system.scm +++ b/guix/build/python-build-system.scm @@ -28,6 +28,8 @@ #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:export (%standard-phases + add-installed-pythonpath + site-packages python-build)) ;; Commentary: @@ -76,6 +78,24 @@ (major+minor (take components 2))) (string-join major+minor "."))) +(define (site-packages inputs outputs) + "Return the path of the current output's Python site-package." + (let* ((out (assoc-ref outputs "out")) + (python (assoc-ref inputs "python"))) + (string-append out "/lib/python" + (get-python-version python) + "/site-packages/"))) + +(define (add-installed-pythonpath inputs outputs) + "Prepend the Python site-package of OUTPUT to PYTHONPATH. This is useful +when running checks after installing the package." + (let ((old-path (getenv "PYTHONPATH")) + (add-path (site-packages inputs outputs))) + (setenv "PYTHONPATH" + (string-append add-path + (if old-path (string-append ":" old-path) ""))) + #t)) + (define* (install #:key outputs (configure-flags '()) use-setuptools? #:allow-other-keys) "Install a given Python package." |