Gentoo Archives: gentoo-dev

From: Jason Zaman <perfinion@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [RFC] dev-python/setuptools deps in distutils-r1 packages
Date: Tue, 26 Nov 2019 16:00:54
Message-Id: 20191126160043.GA1004@baraddur.perfinion.com
In Reply to: Re: [gentoo-dev] [RFC] dev-python/setuptools deps in distutils-r1 packages by "Michał Górny"
1 On Tue, Nov 26, 2019 at 04:29:28PM +0100, Michał Górny wrote:
2 > On Tue, 2019-11-26 at 21:30 +0800, Jason Zaman wrote:
3 > > On Mon, Nov 25, 2019 at 06:38:47PM +0100, Michał Górny wrote:
4 > > > Hi,
5 > > >
6 > > > TL;DR: should we depend on setuptools by default? Alternatively, should
7 > > > we add distutils_enable_setuptools API to provide at least partial
8 > > > validity checks.
9 > > >
10 > > >
11 > > > Variant 1: automatic dependency on setuptools
12 > > > =============================================
13 > > > Basically, we add a new trinary pre-inherit variable:
14 > > >
15 > > > DISTUTILS_USE_SETUPTOOLS=no
16 > > > -> no deps
17 > > > DISTUTILS_USE_SETUPTOOLS=bdepend
18 > > > -> add to BDEPEND (the default)
19 > > > DISTUTILS_USE_SETUPTOOLS=rdepend
20 > > > -> add to BDEPEND+RDEPEND
21 > > >
22 > > > This is roughly 'erring on the safe side'. The default will work for
23 > > > the majority of packages. We will have to disable it for setuptools
24 > > > bootstrap deps, and devs will be able to adjust it to correct values
25 > > > as they update ebuilds. For the time being, existing *DEPEND
26 > > > on setuptools will avoid breaking stuff.
27 > > >
28 > > > This will also enable me to add extra QA checks to esetup.py. It should
29 > > > be able to reasonably detect incorrect value and report it. This will
30 > > > imply some 'false positives' for packages that use the old method of
31 > > > specifying setuptools in RDEPEND but that's a minor hassle.
32 > > >
33 > > > Pros:
34 > > > - works out of the box for the majority of packages
35 > > > - enables full-range QA checking
36 > > >
37 > > > Cons:
38 > > > - pre-inherit variable
39 > > > - some (harmless) false positives on existing packages
40 > > >
41 > >
42 > > I like variant 1 most since in almost all cases it'll be less work in
43 > > the ebuilds. What about distutils_optional tho? In tensorflow I have all
44 > > the python support behind USE="python" and guard all the deps. In the
45 > > optional case is there any way for this to work other than just setting
46 > > it to no and doing it manually?
47 > > I assume if i set it to no and make it optional then the esetup.py
48 > > checks wouldnt happen which isnt as nice.
49 >
50 > That's a very good question, and I'm afraid I don't have a good answer.
51 > To be honest, I don't see how we could solve this.
52 >
53 > Since you need to add the appropriate variables to BDEPEND and RDEPEND
54 > yourself, there's little purpose in trying to introduce some kind of
55 > indirection for this -- it may detect that you've declared the wrong
56 > kind of dep but it won't detect if you used the helper variables
57 > correctly, so we're back to square one.
58 >
59 > I guess the only reasonable thing to do is to ignore it entirely for
60 > this use case, and rely on the developer doing things right. Hopefully,
61 > FWICS it's just 43 packages at the moment, so this wouldn't be that bad.
62
63 I suspected this would be the case. I think its fine to not do it in the
64 optional case and just update the docs to be really clear exactly what
65 and how the ebuild must do is good enough. 43 packages out of the many
66 thousand that use distutils-r1 seems like worrying about it isnt worth
67 it yeah.
68
69 -- Jason
70 >
71 > --
72 > Best regards,
73 > Michał Górny
74 >