[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/05: build-system/python: Delay evaluation of the 'python2' package.
From: |
Ludovic Courtès |
Subject: |
05/05: build-system/python: Delay evaluation of the 'python2' package. |
Date: |
Thu, 12 Mar 2015 20:00:15 +0000 |
civodul pushed a commit to branch master
in repository guix.
commit 8c9653b3735749cc16e01c6d0a9de7a89e038a18
Author: Ludovic Courtès <address@hidden>
Date: Thu Mar 12 19:31:07 2015 +0100
build-system/python: Delay evaluation of the 'python2' package.
This fixes a bug whereby uses of 'package-with-python2' at the top-level
in modules other than (gnu packages python) could lead to an "Unbound
variable: python2" error due to the circular references.
Reported by Tomáš Čech.
* guix/build-system/python.scm (package-with-explicit-python)[arguments]:
Check whether PYTHON is a promise, and force it if it is.
(package-with-python2): Wrap 'default-python2' call in 'delay'.
---
guix/build-system/python.scm | 13 ++++++++++---
1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm
index e8af9f8..3710865 100644
--- a/guix/build-system/python.scm
+++ b/guix/build-system/python.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2014 Ludovic Courtès <address@hidden>
+;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <address@hidden>
;;; Copyright © 2013 Andreas Enge <address@hidden>
;;; Copyright © 2013 Nikita Karetnikov <address@hidden>
;;;
@@ -76,7 +76,10 @@ prepended to the name."
(substring name (string-length
old-prefix))
name))))
(arguments
- (let ((arguments (package-arguments p)))
+ (let ((arguments (package-arguments p))
+ (python (if (promise? python)
+ (force python)
+ python)))
(if (member #:python arguments)
(substitute-keyword-arguments arguments ((#:python p) python))
(append arguments `(#:python ,python)))))
@@ -86,7 +89,11 @@ prepended to the name."
p)))
(define package-with-python2
- (cut package-with-explicit-python <> (default-python2) "python-" "python2-"))
+ ;; Note: delay call to 'default-python2' until after the 'arguments' field
+ ;; of packages is accessed to avoid a circular dependency when evaluating
+ ;; the top-level of (gnu packages python).
+ (cut package-with-explicit-python <> (delay (default-python2))
+ "python-" "python2-"))
(define* (lower name
#:key source inputs native-inputs outputs system target
- branch master updated (46ffff9 -> 8c9653b), Ludovic Courtès, 2015/03/12
- 03/05: system: Adjust '.bashrc' skeleton for non-interactive SSH sessions., Ludovic Courtès, 2015/03/12
- 05/05: build-system/python: Delay evaluation of the 'python2' package.,
Ludovic Courtès <=
- 02/05: gnu: Move cflow, Complexity, and GLOBAL to (gnu packages code)., Ludovic Courtès, 2015/03/12
- 01/05: gnu: Add SLOCCount., Ludovic Courtès, 2015/03/12
- 04/05: services: bitlbee: Make /var/lib/bitlbee when activating., Ludovic Courtès, 2015/03/12