[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
‘package-with-python2’ and ‘strip-python2-variant’
From: |
Ludovic Courtès |
Subject: |
‘package-with-python2’ and ‘strip-python2-variant’ |
Date: |
Tue, 26 Apr 2016 11:52:24 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Hartmut Goebel <address@hidden> skribis:
>> On Sun, Apr 17, 2016 at 10:54:03AM +1000, Ben Woodcroft wrote:
>>> (define-public python2-ipython
>>> - (let ((ipython (package-with-python2 python-ipython)))
>>> + (let ((parent (package-with-python2
>>> + (strip-python2-variant python-ipython))))
>
> I wonder why this "strip-python2-variant" is not integrated into
> package-with-python2?
>
> Having it separately IMHO is of no use, it just adds additional code to
> be copy&pasted.
You’re right, we can eventually apply this patch:
diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm
index 326e6fd..3b775d6 100644
--- a/guix/build-system/python.scm
+++ b/guix/build-system/python.scm
@@ -68,7 +68,8 @@ extension, such as '.tar.gz'."
(module-ref python 'python-2)))
(define* (package-with-explicit-python python old-prefix new-prefix
- #:key variant-property)
+ #:key
+ variant-property)
"Return a procedure of one argument, P. The procedure creates a package with
the same fields as P, which is assumed to use PYTHON-BUILD-SYSTEM, such that
it is compiled with PYTHON instead. The inputs are changed recursively
@@ -130,19 +131,23 @@ pre-defined variants."
transform)
+(define (strip-python2-variant p)
+ "Remove the 'python2-variant' property from P."
+ (package
+ (inherit p)
+ (properties (alist-delete 'python2-variant (package-properties p)))))
+
(define package-with-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).
- (package-with-explicit-python (delay (default-python2))
+ (compose (package-with-explicit-python (delay (default-python2))
"python-" "python2-"
- #:variant-property 'python2-variant))
+ #:variant-property 'python2-variant)
-(define (strip-python2-variant p)
- "Remove the 'python2-variant' property from P."
- (package
- (inherit p)
- (properties (alist-delete 'python2-variant (package-properties p)))))
+ ;; Since this is the user-facing procedure, we always want to strip
+ ;; the 'python2-variant' property.
+ strip-python2-variant))
(define* (lower name
#:key source inputs native-inputs outputs system target
However, before this is possible, we must first change all patterns like:
(define-public python-netaddr …)
(define-public python2-netaddr
(package-with-python2 python-netaddr))
to:
(define-public python-netaddr
(package
;; …
(properties `((python2-variant . ,(delay python2-netaddr))))))
(define-public python2-netaddr
(package-with-python2 (strip-python2-variant python-netaddr)))
and make sure (with “guix build python2-netaddr -d” and similar) that
the changes have no impact on the resulting derivation.
Volunteers? :-)
Thanks,
Ludo’.