guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

06/163: build/python: Add the installation bin directory to PATH.


From: guix-commits
Subject: 06/163: build/python: Add the installation bin directory to PATH.
Date: Mon, 25 Jan 2021 02:01:14 -0500 (EST)

apteryx pushed a commit to branch cu/farewell-to-pythonpath
in repository guix.

commit 119e30a4620940be3dfba49d3e84123786f16228
Author: Maxim Cournoyer <maxim.cournoyer@gmail.com>
AuthorDate: Fri Jan 22 11:48:42 2021 -0500

    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.
---
 guix/build/python-build-system.scm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/guix/build/python-build-system.scm 
b/guix/build/python-build-system.scm
index ca2e08f..19bd3c9 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -195,6 +195,12 @@ useful when running checks after installing the package."
   "This adds the installed site-packages directory to the Guix PYTHONPATH."
   (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."
@@ -312,6 +318,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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]