1 |
Hey, |
2 |
|
3 |
|
4 |
On 11/25/19 7:38 PM, Michał Górny wrote: |
5 |
> Hi, |
6 |
> |
7 |
> TL;DR: should we depend on setuptools by default? Alternatively, should |
8 |
> we add distutils_enable_setuptools API to provide at least partial |
9 |
> validity checks. |
10 |
> |
11 |
> |
12 |
> The problem |
13 |
> =========== |
14 |
> The vast majority of Python packages nowadays uses setuptools as their |
15 |
> build system. According to a cheap grep, 1633 out of 2415 packages |
16 |
> using distutils-r1 depends on it -- and I suspect the vast majority of |
17 |
> those that do not are simply missing the dependency. |
18 |
|
19 |
Truthfully I thought distutils already (B)DEPENDed on setuptools, so at |
20 |
least I've left it out "on purpose". I was recently made aware it |
21 |
doesn't. No bug reports are made about it, so I think it's safe to |
22 |
assume setuptools is already present in every system? |
23 |
|
24 |
|
25 |
> |
26 |
> Are there valid cases for not using setuptools? Notably, packages |
27 |
> needed to bootstrap setuptools aren't using it. Plus some simple |
28 |
> packages that really don't need its features. |
29 |
> |
30 |
> There are also packages that use setuptools but have distutils fallback. |
31 |
> We don't like them because switching between build systems involves file |
32 |
> <-> directory replacement that isn't handled cleanly by our package |
33 |
> managers. Therefore, we want to always force one build system in them. |
34 |
> |
35 |
> The setuptools dependency is so common it's easy to miss. Notably, it's |
36 |
> a prerequisite of specifying package dependencies, so it's normally not |
37 |
> listed in dependencies. |
38 |
> |
39 |
> Finally, while most of the time setuptools is just BDEPEND, there are |
40 |
> cases when it's RDEPEND as well. The most common is the use |
41 |
> of entry_points -- and again, upstreams don't mention it explicitly. |
42 |
> |
43 |
> All that considered, I think we should work on providing a better API |
44 |
> for depending on setuptools, to reduce the number of missing |
45 |
> dependencies and make it possible to automatically test for them |
46 |
> (reminder: PMS doesn't permit inspecting *DEPEND). |
47 |
> |
48 |
> |
49 |
> Variant 1: automatic dependency on setuptools |
50 |
> ============================================= |
51 |
> Basically, we add a new trinary pre-inherit variable: |
52 |
> |
53 |
> DISTUTILS_USE_SETUPTOOLS=no |
54 |
> -> no deps |
55 |
> DISTUTILS_USE_SETUPTOOLS=bdepend |
56 |
> -> add to BDEPEND (the default) |
57 |
> DISTUTILS_USE_SETUPTOOLS=rdepend |
58 |
> -> add to BDEPEND+RDEPEND |
59 |
> |
60 |
> This is roughly 'erring on the safe side'. The default will work for |
61 |
> the majority of packages. We will have to disable it for setuptools |
62 |
> bootstrap deps, and devs will be able to adjust it to correct values |
63 |
> as they update ebuilds. For the time being, existing *DEPEND |
64 |
> on setuptools will avoid breaking stuff. |
65 |
> |
66 |
> This will also enable me to add extra QA checks to esetup.py. It should |
67 |
> be able to reasonably detect incorrect value and report it. This will |
68 |
> imply some 'false positives' for packages that use the old method of |
69 |
> specifying setuptools in RDEPEND but that's a minor hassle. |
70 |
> |
71 |
> Pros: |
72 |
> - works out of the box for the majority of packages |
73 |
> - enables full-range QA checking |
74 |
> |
75 |
> Cons: |
76 |
> - pre-inherit variable |
77 |
> - some (harmless) false positives on existing packages |
78 |
|
79 |
I'm a fan of this solution, unless it causes a lot of new CI noise. I |
80 |
think people are getting fed up with recent changes already, starting to |
81 |
ignore whatever CI bot says, unless it's fatal. |
82 |
|
83 |
No harm in double-defining setuptools in BDEPEND right...? (via eclass |
84 |
and ebuild) |
85 |
|
86 |
|
87 |
> |
88 |
> |
89 |
> Variant 2: distutils_enable_setuptools |
90 |
> ====================================== |
91 |
> The alternative method is to add another function |
92 |
> to the distutils_enable* series: |
93 |
> |
94 |
> distutils_enable_setuptools [-r] |
95 |
> |
96 |
> The basic form adds it to BDEPEND, -r B+RDEPEND. Of course, no dep is |
97 |
> present by default. The main difference from setting deps explicitly is |
98 |
> that it permits us to do a minimal QA check between pure BDEPEND |
99 |
> and B+RDEPEND for now. |
100 |
> |
101 |
> When all ebuilds are migrated from explicit dependencies to this method, |
102 |
> we can also start detecting missing deps completely. However, that |
103 |
> presumes we require using this function rather than explicit deps. |
104 |
> |
105 |
> Pros: |
106 |
> - no pre-inherit variables |
107 |
> |
108 |
> Cons: |
109 |
> - only partial QA check possible for the time being |
110 |
> - requires migrating all ebuilds long-term |
111 |
|
112 |
I don't like this at this point. This would just bring unwanted noise |
113 |
and lots of editing in ebuilds. V1 and V3 are better IMHO. This could be |
114 |
implemented in distutils-r2.eclass, though. |
115 |
|
116 |
|
117 |
> |
118 |
> |
119 |
> Variant 3: leave as-is, add minimal install-qa-check.d |
120 |
> ====================================================== |
121 |
> We can just continue adding deps manually, and add a minimal install-qa- |
122 |
> check.d that greps installed scripts for entry_points usage. This will |
123 |
> let us detect missing RDEPEND on setuptools but not BDEPEND. |
124 |
> |
125 |
> Pros: |
126 |
> - no changes to ebuilds |
127 |
> |
128 |
> Cons: |
129 |
> - only partial QA check possible |
130 |
|
131 |
The old way, is also good. |
132 |
|
133 |
|
134 |
> |
135 |
> |
136 |
> WDYT? |
137 |
> ===== |
138 |
> Both options have their pros and cons. I think V1 is the best since it |
139 |
> avoids a common mistake, and gives full range QA check. It also doesn't |
140 |
> interfere with existing deps. V2 neatly fits into the recent series but |
141 |
> still requires users to remember to call it, and we can't report missing |
142 |
> calls until we clean up all ebuilds. V3 provides only minimal QA |
143 |
> improvement without changing the eclass. |
144 |
> |
145 |
> WDYT? Do you have any other ideas? |
146 |
|
147 |
As I said, I don't even know how one ends up with a system without |
148 |
setuptools, so I don't view this "superimportant". Still I like your |
149 |
suggestions 1 & 3 in handling it in future. However if you're going to |
150 |
implement CI checks with this, I don't believe the timing is right |
151 |
currently. |
152 |
|
153 |
|
154 |
-- juippis |