[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/57: guix: python-build-system: Add helpers for getting and setting PY
From: |
Hartmut Goebel |
Subject: |
05/57: guix: python-build-system: Add helpers for getting and setting PYTHONPATH. |
Date: |
Sat, 15 Oct 2016 14:08:10 +0000 (UTC) |
htgoebel pushed a commit to branch wip-python-build-system
in repository guix.
commit 6017e7269b4ce030541511b5b9b938ce92fa84aa
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 | 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 cded89f..c4e5a75 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."
- branch wip-python-build-system created (now f73de82), Hartmut Goebel, 2016/10/15
- 01/57: gnu: ensure pip and setuptools are installed even for Python 2., Hartmut Goebel, 2016/10/15
- 02/57: guix: build all Python packages with --single-version-externally-managed., Hartmut Goebel, 2016/10/15
- 03/57: guix: python-build-system: Import setuptools before calling `setup.py'., Hartmut Goebel, 2016/10/15
- 15/57: gnu: Remove needless inputs python-pip and python2-pip., Hartmut Goebel, 2016/10/15
- 05/57: guix: python-build-system: Add helpers for getting and setting PYTHONPATH.,
Hartmut Goebel <=
- 04/57: guix: python-build-system: Add option "#:use-setuptools?" (default true)., Hartmut Goebel, 2016/10/15
- 12/57: gnu: Remove python-setuptools and python2-setuptools from inputs (part 3), Hartmut Goebel, 2016/10/15
- 18/57: gnu: python-pytest: Propagate input "python-py"., Hartmut Goebel, 2016/10/15
- 17/57: gnu: scons: Do not use setuptools for building., Hartmut Goebel, 2016/10/15
- 07/57: guix: Add lint-checker for packages which should be no inputs at all., Hartmut Goebel, 2016/10/15
- 08/57: lint: more packages to probably be a native input., Hartmut Goebel, 2016/10/15
- 19/57: gnu: python-pytest-cov: Use upstream options for testing., Hartmut Goebel, 2016/10/15
- 23/57: inputs -> propagated-inputs: special, Hartmut Goebel, 2016/10/15
- 29/57: gnu: python-ccm: Update synopsis and description., Hartmut Goebel, 2016/10/15
- 22/57: gnu: Fix inputs in python.scm, part 2: native-inputs -> propagated-inputs., Hartmut Goebel, 2016/10/15