Add a function to simplify many of the new python2-foo definitions

  • Done
  • quality assurance status badge
Details
4 participants
  • Andreas Enge
  • Christopher Allan Webber
  • Efraim Flashner
  • Ludovic Courtès
Owner
unassigned
Submitted by
Christopher Allan Webber
Severity
normal

Debbugs page

Christopher Allan Webber wrote 9 years ago
(address . bug-guix@gnu.org)
87vb5cebm6.fsf@dustycloud.org
Right now we have a lot of these that look very similar:

(define-public python2-chardet
(package
(inherit (package-with-python2
(strip-python2-variant python-chardet)))
(native-inputs `(("python2-setuptools" ,python2-setuptools)))))

(define-public python2-translitcodec
(package
(inherit (package-with-python2
(strip-python2-variant python-translitcodec)))
(native-inputs `(("python2-setuptools" ,python2-setuptools)))))

(define-public python2-celery
(let ((celery (package-with-python2
(strip-python2-variant python-celery))))
(package
(inherit celery)
(native-inputs `(("python2-setuptools" ,python2-setuptools)
("python2-unittest2" ,python2-unittest2)
("python2-mock" ,python2-mock)
,@(package-native-inputs celery))))))

Time for an abstraction?
Ludovic Courtès wrote 9 years ago
(name . Christopher Allan Webber)(address . cwebber@dustycloud.org)(address . 22808@debbugs.gnu.org)
8760xbyrxd.fsf@gnu.org
Christopher Allan Webber <cwebber@dustycloud.org> skribis:

Toggle quote (8 lines)
> Right now we have a lot of these that look very similar:
>
> (define-public python2-chardet
> (package
> (inherit (package-with-python2
> (strip-python2-variant python-chardet)))
> (native-inputs `(("python2-setuptools" ,python2-setuptools)))))

Right, we discussed before adding the python2-setuptools dependency
automatically as part of ‘package-with-python2’. I think this would be
a good idea, indeed.

We need to see if there are exceptions to this rule.

Any takers? :-)

Ludo’.
Ludovic Courtès wrote 9 years ago
(name . Christopher Allan Webber)(address . cwebber@dustycloud.org)(address . 22808@debbugs.gnu.org)
87lh40wv8r.fsf@gnu.org
ludo@gnu.org (Ludovic Courtès) skribis:

Toggle quote (14 lines)
> Christopher Allan Webber <cwebber@dustycloud.org> skribis:
>
>> Right now we have a lot of these that look very similar:
>>
>> (define-public python2-chardet
>> (package
>> (inherit (package-with-python2
>> (strip-python2-variant python-chardet)))
>> (native-inputs `(("python2-setuptools" ,python2-setuptools)))))
>
> Right, we discussed before adding the python2-setuptools dependency
> automatically as part of ‘package-with-python2’. I think this would be
> a good idea, indeed.

What about this:
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -345,6 +345,14 @@ instead of @command{python3}.")))
(define-public python-wrapper (wrap-python3 python))
(define-public python-minimal-wrapper (wrap-python3 python-minimal))
+(define (package-with-python2+setuptools p)
+ (let ((base (package-with-python2 (strip-python2-variant p))))
+ (package
+ (inherit base)
+ (native-inputs `(("python2-setuptools" ,python2-setuptools)
+ ,@(package-native-inputs base))))))
+
+
(define-public python-psutil
(package
(name "python-psutil")
Then we need to change all the occurrences of this pattern to use this
new procedure.

Thoughts?

Ludo’.
Ludovic Courtès wrote 9 years ago
control message for bug #22808
(address . control@debbugs.gnu.org)
87k2jkwv8g.fsf@gnu.org
tags 22808 patch
Efraim Flashner wrote 9 years ago
Re: bug#22808: Add a function to simplify many of the new python2-foo definitions
(name . Ludovic Courtès)(address . ludo@gnu.org)
20160426124428.GA12637@debian-netbook
On Tue, Apr 26, 2016 at 11:54:28AM +0200, Ludovic Courtès wrote:
Toggle quote (45 lines)
> ludo@gnu.org (Ludovic Courtès) skribis:
>
> > Christopher Allan Webber <cwebber@dustycloud.org> skribis:
> >
> >> Right now we have a lot of these that look very similar:
> >>
> >> (define-public python2-chardet
> >> (package
> >> (inherit (package-with-python2
> >> (strip-python2-variant python-chardet)))
> >> (native-inputs `(("python2-setuptools" ,python2-setuptools)))))
> >
> > Right, we discussed before adding the python2-setuptools dependency
> > automatically as part of ‘package-with-python2’. I think this would be
> > a good idea, indeed.
>
> What about this:
>

> --- a/gnu/packages/python.scm
> +++ b/gnu/packages/python.scm
> @@ -345,6 +345,14 @@ instead of @command{python3}.")))
> (define-public python-wrapper (wrap-python3 python))
> (define-public python-minimal-wrapper (wrap-python3 python-minimal))
>
> +(define (package-with-python2+setuptools p)
> + (let ((base (package-with-python2 (strip-python2-variant p))))
> + (package
> + (inherit base)
> + (native-inputs `(("python2-setuptools" ,python2-setuptools)
> + ,@(package-native-inputs base))))))
> +
> +
> (define-public python-psutil
> (package
> (name "python-psutil")

>
> Then we need to change all the occurrences of this pattern to use this
> new procedure.
>
> Thoughts?
>
> Ludo’.

Would we still need the properties field in python-foo?

What would this mean for packages that need python2-setuptools and other
python2- specific packages? Specifically, would all the calls to
package-native-inputs cause a slowdown in computing the package?

--
Efraim Flashner <efraim@flashner.co.il> אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCgAGBQJXH2KpAAoJEPTB05F+rO6T8agP/ixI27Wjdg50tniOsEpWT3CM
uZUo7LZ5JYRTXXk/mYTKo16DXwvNssr+BiQBs7D68J1a59lff24/HZ0fUWc3bdzz
71UG+TFMvqKPEbxbCjWAcBjedL3j9TMxQuI5lFZ4nAs/nBm/2fZGG+2WQt4wZrKa
t+Mgue/Wg4udP/6CUZQVc0j3ieB7oOvYiMSC0fMLDiDZ1nnDjf3WkJzUc18VYKjE
dmzTS73AX7FeOPcvWet0dsz7JCn3e5ycJJHoF4OcR1yHoz28XI+fViuQWlv3VkIL
JLXTxu9HblmpjRGCCU5cfR7AIta0BgVaOmVzRmTRrRpRp+/Y0beGzcxYh2ZTZ1C3
d0iQz1oIPDpTb44OXvxmex36yLq0bWbA+icOrBuSUpTxMSyUqSGRsV0IIQtqJW/7
RSBhkQSU9acxAPrRG6Cam47VjrjX3Z+xzOqbifxg/iIiWCwIEOMvYdbrzcqlAzc1
Y+7Zua4zcIhL2YGSPUguzH505TstmgzCYlL8YDZn54aGsHKVqVjLpNG2+x2TUbmw
5czMpuiwQtFPTKeomIMuoWpmkOo7hUjr6XxJFBg3RhVqRsmYo+9WHnl5HpyUKRje
cpliBsbkWYr0JLYRQ6/CVuezdysl8jqkHLIsZ1kfmcthHes7uq6k5ReTwsFsDn4A
cbQkajpq3rhgs24czN8V
=4zh4
-----END PGP SIGNATURE-----


Ludovic Courtès wrote 9 years ago
(name . Efraim Flashner)(address . efraim@flashner.co.il)
87oa8wtt38.fsf@gnu.org
Efraim Flashner <efraim@flashner.co.il> skribis:

Toggle quote (3 lines)
> On Tue, Apr 26, 2016 at 11:54:28AM +0200, Ludovic Courtès wrote:
>> ludo@gnu.org (Ludovic Courtès) skribis:

[...]

Toggle quote (31 lines)
>> What about this:
>>
>
>> --- a/gnu/packages/python.scm
>> +++ b/gnu/packages/python.scm
>> @@ -345,6 +345,14 @@ instead of @command{python3}.")))
>> (define-public python-wrapper (wrap-python3 python))
>> (define-public python-minimal-wrapper (wrap-python3 python-minimal))
>>
>> +(define (package-with-python2+setuptools p)
>> + (let ((base (package-with-python2 (strip-python2-variant p))))
>> + (package
>> + (inherit base)
>> + (native-inputs `(("python2-setuptools" ,python2-setuptools)
>> + ,@(package-native-inputs base))))))
>> +
>> +
>> (define-public python-psutil
>> (package
>> (name "python-psutil")
>
>>
>> Then we need to change all the occurrences of this pattern to use this
>> new procedure.
>>
>> Thoughts?
>>
>> Ludo’.
>
> Would we still need the properties field in python-foo?

Yes.

Toggle quote (4 lines)
> What would this mean for packages that need python2-setuptools and other
> python2- specific packages? Specifically, would all the calls to
> package-native-inputs cause a slowdown in computing the package?

It wouldn’t change anything, since this exact same pattern is already
used in many different places in python.scm (search for
“python2-setuptools” and you’ll see :-)). It would simply allow us to
factorize it.

Ludo’.
Andreas Enge wrote 6 years ago
Close
(address . 22808-done@debbugs.gnu.org)
20190131143955.GA25613@jurong
This seems to be solved using package-with-python2.

Andreas
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 22808@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 22808
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help