apteryx pushed a commit to branch cu/farewell-to-pythonpath in repository guix.
commit c3c5bdd2b0ea4588ecba424fdbf6df101d967d3d Author: Maxim Cournoyer <[email protected]> AuthorDate: Fri Jan 22 09:34:33 2021 -0500 build/python: Add a new guix-pythonpath procedure. This procedure will be used in place where the static "PYTHONPATH" string used to be. * guix/build/python-build-system.scm (guix-pythonpath): New procedure. --- guix/build/python-build-system.scm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm index aad8625..77bd621 100644 --- a/guix/build/python-build-system.scm +++ b/guix/build/python-build-system.scm @@ -31,10 +31,12 @@ #:use-module (ice-9 match) #:use-module (ice-9 ftw) #:use-module (ice-9 format) + #:use-module (ice-9 string-fun) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:export (%standard-phases add-installed-pythonpath + guix-pythonpath site-packages python-version python-build)) @@ -158,6 +160,13 @@ (major+minor (take components 2))) (string-join major+minor "."))) +(define (guix-pythonpath inputs) + "Derive the GUIX_PYTHONPATH_X_Y string , with the major and minor version +numbers substituted for X and Y, respectively." + (let ((python (assoc-ref inputs "python"))) + (string-append "GUIX_PYTHONPATH_" + (string-replace-substring (python-version python) "." "_")))) + (define (python-output outputs) "Return the path of the python output, if there is one, or fall-back to out." (or (assoc-ref outputs "python")
