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:
parent
afc720d34c
commit
78a2745370
1 changed files with 18 additions and 24 deletions
|
@ -55,8 +55,7 @@ (define (package-with-explicit-python p python old-prefix new-prefix)
|
|||
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 @@ (define (package-with-explicit-python p python old-prefix new-prefix)
|
|||
(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-"))
|
||||
|
|
Loading…
Reference in a new issue