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.
This commit is contained in:
Ludovic Courtès 2014-12-23 19:11:03 +01:00
parent afc720d34c
commit 78a2745370
1 changed files with 18 additions and 24 deletions

View File

@ -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 inputs are changed recursively accordingly. If the name of P starts with
OLD-PREFIX, this is replaced by NEW-PREFIX; otherwise, NEW-PREFIX is OLD-PREFIX, this is replaced by NEW-PREFIX; otherwise, NEW-PREFIX is
prepended to the name." prepended to the name."
(let* ((build-system (package-build-system p)) (let* ((rewrite-if-package
(rewrite-if-package
(lambda (content) (lambda (content)
;; CONTENT may be a file name, in which case it is returned, or a ;; 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. ;; package, which is rewritten with the new PYTHON and NEW-PREFIX.
@ -68,28 +67,23 @@ prepended to the name."
(match-lambda (match-lambda
((name content . rest) ((name content . rest)
(append (list name (rewrite-if-package content)) rest))))) (append (list name (rewrite-if-package content)) rest)))))
(package (inherit p)
(name (if (eq? (package-build-system p) python-build-system)
(let ((name (package-name p))) (package (inherit p)
(if (eq? build-system python-build-system) (name (let ((name (package-name p)))
(string-append new-prefix (string-append new-prefix
(if (string-prefix? old-prefix name) (if (string-prefix? old-prefix name)
(substring name (string-length old-prefix)) (substring name (string-length old-prefix))
name)) name))))
name))) (arguments
(arguments (let ((arguments (package-arguments p)))
(let ((arguments (package-arguments p))) (if (member #:python arguments)
(if (eq? build-system python-build-system) (substitute-keyword-arguments arguments ((#:python p) python))
(if (member #:python arguments) (append arguments `(#:python ,python)))))
(substitute-keyword-arguments arguments ((#:python p) python)) (inputs (map rewrite (package-inputs p)))
(append arguments `(#:python ,python))) (propagated-inputs (map rewrite (package-propagated-inputs p)))
arguments))) (native-inputs (map rewrite (package-native-inputs p))))
(inputs p)))
(map rewrite (package-inputs p)))
(propagated-inputs
(map rewrite (package-propagated-inputs p)))
(native-inputs
(map rewrite (package-native-inputs p))))))
(define package-with-python2 (define package-with-python2
(cut package-with-explicit-python <> (default-python2) "python-" "python2-")) (cut package-with-explicit-python <> (default-python2) "python-" "python2-"))