[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[WIP 5/8] guix: python-build-system: Add helpers for getting and setting
From: |
Hartmut Goebel |
Subject: |
[WIP 5/8] guix: python-build-system: Add helpers for getting and setting PYTHONPATH. |
Date: |
Mon, 10 Oct 2016 16:57:16 +0200 |
* guix/build/python-build-system.scm (add-installed-pythonpath,
site-packages): New exported procedures.
---
guix/build/python-build-system.scm | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/guix/build/python-build-system.scm
b/guix/build/python-build-system.scm
index 038fa97..1950b3b 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -28,7 +28,9 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:export (%standard-phases
- python-build))
+ python-build
+ add-installed-pythonpath
+ site-packages))
;; Commentary:
;;
@@ -74,6 +76,24 @@
(major+minor (take components 2)))
(string-join major+minor ".")))
+(define (site-packages outputs inputs)
+ "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 outputs inputs)
+ "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 outputs inputs)))
+ (setenv "PYTHONPATH"
+ (string-append add-path
+ (if old-path (string-append ":" old-path) "")))
+ #t))
+
(define* (install #:key outputs inputs (configure-flags '()) use-setuptools?
#:allow-other-keys)
"Install a given Python package."
--
2.7.4
- [WIP 0/9] python-build-system set 1: please review, Hartmut Goebel, 2016/10/10
- [WIP 3/8] guix: python-build-system: Import setuptools before calling `setup.py'., Hartmut Goebel, 2016/10/10
- [WIP 1/8] gnu: ensure pip and setuptools are installed even for Python 2., Hartmut Goebel, 2016/10/10
- [WIP 2/8] guix: build all Python packages with --single-version-externally-managed., Hartmut Goebel, 2016/10/10
- [WIP 5/8] guix: python-build-system: Add helpers for getting and setting PYTHONPATH.,
Hartmut Goebel <=
- [WIP 4/8] guix: python-build-system: Add option "#:use-setuptools?" (default true)., Hartmut Goebel, 2016/10/10
- [WIP 6/8] guix: python-build-system: Delete .egg-info file created in phase check., Hartmut Goebel, 2016/10/10
- [WIP 7/8] guix: Add lint-checker for packages which should be no inputs at all., Hartmut Goebel, 2016/10/10
- [WIP 8/8] lint: more packages to probably be a native input., Hartmut Goebel, 2016/10/10
- Re: [WIP 0/9] python-build-system set 1: please review, Hartmut Goebel, 2016/10/11
- Re: [WIP 0/9] python-build-system set 1: please review, Hartmut Goebel, 2016/10/11