[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
06/103: guix: python-build-system: Add helpers for getting and setting P
From: |
Hartmut Goebel |
Subject: |
06/103: guix: python-build-system: Add helpers for getting and setting PYTHONPATH. |
Date: |
Tue, 25 Oct 2016 18:00:34 +0000 (UTC) |
htgoebel pushed a commit to branch wip-python-build-system
in repository guix.
commit 0b52e9974cef3ba88abcedfa3c248a4eea14de9b
Author: Hartmut Goebel <address@hidden>
Date: Sat Oct 8 12:04:20 2016 +0200
guix: python-build-system: Add helpers for getting and setting PYTHONPATH.
* guix/build/python-build-system.scm (add-installed-pythonpath,
site-packages): New exported procedures.
---
guix/build/python-build-system.scm | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/guix/build/python-build-system.scm
b/guix/build/python-build-system.scm
index ee40645..a4e8038 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -28,6 +28,8 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:export (%standard-phases
+ add-installed-pythonpath
+ site-packages
python-build))
;; Commentary:
@@ -74,6 +76,24 @@
(major+minor (take components 2)))
(string-join major+minor ".")))
+(define (site-packages inputs outputs)
+ "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 inputs outputs)
+ "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 inputs outputs)))
+ (setenv "PYTHONPATH"
+ (string-append add-path
+ (if old-path (string-append ":" old-path) "")))
+ #t))
+
(define* (install #:key outputs (configure-flags '()) use-setuptools?
#:allow-other-keys)
"Install a given Python package."
- branch wip-python-build-system created (now 0832852), Hartmut Goebel, 2016/10/25
- 06/103: guix: python-build-system: Add helpers for getting and setting PYTHONPATH.,
Hartmut Goebel <=
- 04/103: guix: python-build-system: Import setuptools before calling `setup.py'., Hartmut Goebel, 2016/10/25
- 05/103: guix: python-build-system: Add option "#:use-setuptools?" (default true)., Hartmut Goebel, 2016/10/25
- 02/103: gnu: ensure pip and setuptools are installed even for Python 2., Hartmut Goebel, 2016/10/25
- 07/103: guix: python-build-system: Delete .egg-info file created in phase check., Hartmut Goebel, 2016/10/25
- 01/103: guix: python-build-system: Fix an outdated comment., Hartmut Goebel, 2016/10/25
- 03/103: guix: build all Python packages with --single-version-externally-managed., Hartmut Goebel, 2016/10/25
- 09/103: guix: Add lint-checker for packages which should be no inputs at all., Hartmut Goebel, 2016/10/25
- 10/103: lint: more packages to probably be a native input., Hartmut Goebel, 2016/10/25
- 17/103: gnu: Remove needless inputs python-pip and python2-pip., Hartmut Goebel, 2016/10/25
- 22/103: gnu: Fix python inputs, part 4: special cases., Hartmut Goebel, 2016/10/25