summaryrefslogtreecommitdiff
path: root/guix/build/python-build-system.scm
diff options
context:
space:
mode:
authorMaxim Cournoyer <maxim.cournoyer@gmail.com>2021-01-22 11:48:42 -0500
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2021-02-01 11:53:43 -0500
commit15dcffecf2293c86d81186a6e3a29e25b00420aa (patch)
tree42cfcd294dbecde9aa9453220b540394f8b3b140 /guix/build/python-build-system.scm
parent91cf9d17f02fdf82424c7f2dda2c3651f992bf13 (diff)
downloadguix-patches-15dcffecf2293c86d81186a6e3a29e25b00420aa.tar
guix-patches-15dcffecf2293c86d81186a6e3a29e25b00420aa.tar.gz
build/python: Add the installation bin directory to PATH.
This also to reduce the need for boilerplate code found in check phase overrides. * guix/build/python-build-system.scm (add-install-to-path): New phase. (%standard-phases): Order it before the check phase.
Diffstat (limited to 'guix/build/python-build-system.scm')
-rw-r--r--guix/build/python-build-system.scm7
1 files changed, 7 insertions, 0 deletions
diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm
index 9f5fad7faf..c73f6b0603 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -179,6 +179,12 @@ running checks after installing the package."
"A phase that just wraps the 'add-installed-pythonpath' procedure."
(add-installed-pythonpath inputs outputs))
+(define* (add-install-to-path #:key outputs #:allow-other-keys)
+ "Adding Python scripts to PATH is also often useful in tests."
+ (setenv "PATH" (string-append (assoc-ref outputs "out")
+ "/bin:"
+ (getenv "PATH"))))
+
(define* (install #:key inputs outputs (configure-flags '()) use-setuptools?
#:allow-other-keys)
"Install a given Python package."
@@ -296,6 +302,7 @@ by Cython."
(add-after 'install 'check check)
(add-after 'install 'wrap wrap)
(add-before 'check 'add-install-to-pythonpath add-install-to-pythonpath)
+ (add-before 'check 'add-install-to-path add-install-to-path)
(add-before 'strip 'rename-pth-file rename-pth-file)))
(define* (python-build #:key inputs (phases %standard-phases)