mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 15:36:20 -05:00
build/python: Always add the install prefix to the Guix PYTHONPATH.
This is to remove the need for common boilerplate code in check phase overrides. * guix/build/python-build-system.scm (add-installed-pythonpath): Streamline. This phase depends on the presence of a "python" input; thus GUIX_PYTHONPATH is guaranteed to be defined. Update doc. (add-install-to-pythonpath): New phase. (%standard-phases): Order it before the check phase.
This commit is contained in:
parent
18e9979970
commit
91cf9d17f0
1 changed files with 10 additions and 8 deletions
|
@ -6,7 +6,7 @@
|
||||||
;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
|
;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
|
||||||
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
|
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
|
||||||
;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
|
;;; Copyright © 2018 Arun Isaac <arunisaac@systemreboot.net>
|
||||||
;;; Copyright © 2019, 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
;;; Copyright © 2019, 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
|
||||||
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
|
;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
|
||||||
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
|
;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
|
||||||
;;;
|
;;;
|
||||||
|
@ -170,13 +170,14 @@ (define (site-packages inputs outputs)
|
||||||
(string-append out "/lib/python" (python-version python) "/site-packages")))
|
(string-append out "/lib/python" (python-version python) "/site-packages")))
|
||||||
|
|
||||||
(define (add-installed-pythonpath inputs outputs)
|
(define (add-installed-pythonpath inputs outputs)
|
||||||
"Add the Python site-package of OUTPUT to GUIX_PYTHONPATH. This is useful
|
"Prepend the site-package of OUTPUT to GUIX_PYTHONPATH. This is useful when
|
||||||
when running checks after installing the package."
|
running checks after installing the package."
|
||||||
(let ((old-path (getenv "GUIX_PYTHONPATH"))
|
(setenv "GUIX_PYTHONPATH" (string-append (site-packages inputs outputs) ":"
|
||||||
(new-path (site-packages inputs outputs)))
|
(getenv "GUIX_PYTHONPATH"))))
|
||||||
(setenv "GUIX_PYTHONPATH"
|
|
||||||
(string-append new-path
|
(define* (add-install-to-pythonpath #:key inputs outputs #:allow-other-keys)
|
||||||
(if old-path (string-append ":" old-path) "")))))
|
"A phase that just wraps the 'add-installed-pythonpath' procedure."
|
||||||
|
(add-installed-pythonpath inputs outputs))
|
||||||
|
|
||||||
(define* (install #:key inputs outputs (configure-flags '()) use-setuptools?
|
(define* (install #:key inputs outputs (configure-flags '()) use-setuptools?
|
||||||
#:allow-other-keys)
|
#:allow-other-keys)
|
||||||
|
@ -294,6 +295,7 @@ (define %standard-phases
|
||||||
(replace 'install install)
|
(replace 'install install)
|
||||||
(add-after 'install 'check check)
|
(add-after 'install 'check check)
|
||||||
(add-after 'install 'wrap wrap)
|
(add-after 'install 'wrap wrap)
|
||||||
|
(add-before 'check 'add-install-to-pythonpath add-install-to-pythonpath)
|
||||||
(add-before 'strip 'rename-pth-file rename-pth-file)))
|
(add-before 'strip 'rename-pth-file rename-pth-file)))
|
||||||
|
|
||||||
(define* (python-build #:key inputs (phases %standard-phases)
|
(define* (python-build #:key inputs (phases %standard-phases)
|
||||||
|
|
Loading…
Reference in a new issue