From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: =?utf-8?Q?=E2=80=98package-with-python2=E2=80=99?= and =?utf-8?Q?=E2=80=98strip-python2-variant=E2=80=99?= Date: Tue, 26 Apr 2016 11:52:24 +0200 Message-ID: <87r3dswvc7.fsf_-_@gnu.org> References: <5712DEAB.8000001@uq.edu.au> <20160418190710.GC27770@jasmine> <571920D6.8020302@goebel-consult.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40709) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1auzfV-0005X7-Pv for guix-devel@gnu.org; Tue, 26 Apr 2016 05:52:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1auzfQ-0002H4-LE for guix-devel@gnu.org; Tue, 26 Apr 2016 05:52:33 -0400 In-Reply-To: <571920D6.8020302@goebel-consult.de> (Hartmut Goebel's message of "Thu, 21 Apr 2016 20:49:58 +0200") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Hartmut Goebel Cc: guix-devel@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hartmut Goebel 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=E2=80=99re right, we can eventually apply this patch: --=-=-= Content-Type: text/x-patch Content-Disposition: inline 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 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable However, before this is possible, we must first change all patterns like: (define-public python-netaddr =E2=80=A6) (define-public python2-netaddr (package-with-python2 python-netaddr)) to: (define-public python-netaddr (package ;; =E2=80=A6 (properties `((python2-variant . ,(delay python2-netaddr)))))) (define-public python2-netaddr (package-with-python2 (strip-python2-variant python-netaddr))) and make sure (with =E2=80=9Cguix build python2-netaddr -d=E2=80=9D and sim= ilar) that the changes have no impact on the resulting derivation. Volunteers? :-) Thanks, Ludo=E2=80=99. --=-=-=--