summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-12-23 19:11:03 +0100
committerLudovic Courtès <ludo@gnu.org>2014-12-23 19:14:52 +0100
commit78a274537032bdd61a11845ac0cf48cb121e8458 (patch)
treed05c2dea8c6ab1a04411bc5755a77a60ab12e748
parentafc720d34c43a2fcf0b5871226c15ad6c5f73697 (diff)
build-system/python: Fix 'package-with-explicit-python'.
Reported by Federico Beffa <beffa@ieee.org> and Eric Bavier <ericbavier@gmail.com>. * guix/build-system/python.scm (package-with-explicit-python): Do nothing when P's build system is not PYTHON-BUILD-SYSTEM.
-rw-r--r--guix/build-system/python.scm42
1 files changed, 18 insertions, 24 deletions
diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm
index 4bba7167ca..e8af9f8146 100644
--- a/guix/build-system/python.scm
+++ b/guix/build-system/python.scm
@@ -55,8 +55,7 @@ PYTHON-BUILD-SYSTEM, such that it is compiled with PYTHON instead. The
inputs are changed recursively accordingly. If the name of P starts with
OLD-PREFIX, this is replaced by NEW-PREFIX; otherwise, NEW-PREFIX is
prepended to the name."
- (let* ((build-system (package-build-system p))
- (rewrite-if-package
+ (let* ((rewrite-if-package
(lambda (content)
;; CONTENT may be a file name, in which case it is returned, or a
;; package, which is rewritten with the new PYTHON and NEW-PREFIX.
@@ -68,28 +67,23 @@ prepended to the name."
(match-lambda
((name content . rest)
(append (list name (rewrite-if-package content)) rest)))))
- (package (inherit p)
- (name
- (let ((name (package-name p)))
- (if (eq? build-system python-build-system)
- (string-append new-prefix
- (if (string-prefix? old-prefix name)
- (substring name (string-length old-prefix))
- name))
- name)))
- (arguments
- (let ((arguments (package-arguments p)))
- (if (eq? build-system python-build-system)
- (if (member #:python arguments)
- (substitute-keyword-arguments arguments ((#:python p) python))
- (append arguments `(#:python ,python)))
- arguments)))
- (inputs
- (map rewrite (package-inputs p)))
- (propagated-inputs
- (map rewrite (package-propagated-inputs p)))
- (native-inputs
- (map rewrite (package-native-inputs p))))))
+
+ (if (eq? (package-build-system p) python-build-system)
+ (package (inherit p)
+ (name (let ((name (package-name p)))
+ (string-append new-prefix
+ (if (string-prefix? old-prefix name)
+ (substring name (string-length old-prefix))
+ name))))
+ (arguments
+ (let ((arguments (package-arguments p)))
+ (if (member #:python arguments)
+ (substitute-keyword-arguments arguments ((#:python p) python))
+ (append arguments `(#:python ,python)))))
+ (inputs (map rewrite (package-inputs p)))
+ (propagated-inputs (map rewrite (package-propagated-inputs p)))
+ (native-inputs (map rewrite (package-native-inputs p))))
+ p)))
(define package-with-python2
(cut package-with-explicit-python <> (default-python2) "python-" "python2-"))