From 78a274537032bdd61a11845ac0cf48cb121e8458 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 23 Dec 2014 19:11:03 +0100 Subject: [PATCH] build-system/python: Fix 'package-with-explicit-python'. Reported by Federico Beffa and Eric Bavier . * guix/build-system/python.scm (package-with-explicit-python): Do nothing when P's build system is not PYTHON-BUILD-SYSTEM. --- guix/build-system/python.scm | 42 ++++++++++++++++-------------------- 1 file 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-"))