From: ludo@gnu.org (Ludovic Courtès)
To: Hartmut Goebel <h.goebel@goebel-consult.de>
Cc: guix-devel@gnu.org
Subject: ‘package-with-python2’ and ‘strip-python2-variant’
Date: Tue, 26 Apr 2016 11:52:24 +0200 [thread overview]
Message-ID: <87r3dswvc7.fsf_-_@gnu.org> (raw)
In-Reply-To: <571920D6.8020302@goebel-consult.de> (Hartmut Goebel's message of "Thu, 21 Apr 2016 20:49:58 +0200")
[-- Attachment #1: Type: text/plain, Size: 582 bytes --]
Hartmut Goebel <h.goebel@goebel-consult.de> 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:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 2008 bytes --]
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
[-- Attachment #3: Type: text/plain, Size: 616 bytes --]
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’.
next prev parent reply other threads:[~2016-04-26 9:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-17 0:54 [PATCH] IPython: Use 'python2-variant' Ben Woodcroft
2016-04-18 19:07 ` Leo Famulari
2016-04-19 9:15 ` Ben Woodcroft
2016-04-20 1:16 ` Leo Famulari
2016-04-21 18:49 ` Hartmut Goebel
2016-04-26 9:52 ` Ludovic Courtès [this message]
2016-04-21 18:51 ` Hartmut Goebel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r3dswvc7.fsf_-_@gnu.org \
--to=ludo@gnu.org \
--cc=guix-devel@gnu.org \
--cc=h.goebel@goebel-consult.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).