1 |
Hi, |
2 |
|
3 |
TL;DR: should we depend on setuptools by default? Alternatively, should |
4 |
we add distutils_enable_setuptools API to provide at least partial |
5 |
validity checks. |
6 |
|
7 |
|
8 |
The problem |
9 |
=========== |
10 |
The vast majority of Python packages nowadays uses setuptools as their |
11 |
build system. According to a cheap grep, 1633 out of 2415 packages |
12 |
using distutils-r1 depends on it -- and I suspect the vast majority of |
13 |
those that do not are simply missing the dependency. |
14 |
|
15 |
Are there valid cases for not using setuptools? Notably, packages |
16 |
needed to bootstrap setuptools aren't using it. Plus some simple |
17 |
packages that really don't need its features. |
18 |
|
19 |
There are also packages that use setuptools but have distutils fallback. |
20 |
We don't like them because switching between build systems involves file |
21 |
<-> directory replacement that isn't handled cleanly by our package |
22 |
managers. Therefore, we want to always force one build system in them. |
23 |
|
24 |
The setuptools dependency is so common it's easy to miss. Notably, it's |
25 |
a prerequisite of specifying package dependencies, so it's normally not |
26 |
listed in dependencies. |
27 |
|
28 |
Finally, while most of the time setuptools is just BDEPEND, there are |
29 |
cases when it's RDEPEND as well. The most common is the use |
30 |
of entry_points -- and again, upstreams don't mention it explicitly. |
31 |
|
32 |
All that considered, I think we should work on providing a better API |
33 |
for depending on setuptools, to reduce the number of missing |
34 |
dependencies and make it possible to automatically test for them |
35 |
(reminder: PMS doesn't permit inspecting *DEPEND). |
36 |
|
37 |
|
38 |
Variant 1: automatic dependency on setuptools |
39 |
============================================= |
40 |
Basically, we add a new trinary pre-inherit variable: |
41 |
|
42 |
DISTUTILS_USE_SETUPTOOLS=no |
43 |
-> no deps |
44 |
DISTUTILS_USE_SETUPTOOLS=bdepend |
45 |
-> add to BDEPEND (the default) |
46 |
DISTUTILS_USE_SETUPTOOLS=rdepend |
47 |
-> add to BDEPEND+RDEPEND |
48 |
|
49 |
This is roughly 'erring on the safe side'. The default will work for |
50 |
the majority of packages. We will have to disable it for setuptools |
51 |
bootstrap deps, and devs will be able to adjust it to correct values |
52 |
as they update ebuilds. For the time being, existing *DEPEND |
53 |
on setuptools will avoid breaking stuff. |
54 |
|
55 |
This will also enable me to add extra QA checks to esetup.py. It should |
56 |
be able to reasonably detect incorrect value and report it. This will |
57 |
imply some 'false positives' for packages that use the old method of |
58 |
specifying setuptools in RDEPEND but that's a minor hassle. |
59 |
|
60 |
Pros: |
61 |
- works out of the box for the majority of packages |
62 |
- enables full-range QA checking |
63 |
|
64 |
Cons: |
65 |
- pre-inherit variable |
66 |
- some (harmless) false positives on existing packages |
67 |
|
68 |
|
69 |
Variant 2: distutils_enable_setuptools |
70 |
====================================== |
71 |
The alternative method is to add another function |
72 |
to the distutils_enable* series: |
73 |
|
74 |
distutils_enable_setuptools [-r] |
75 |
|
76 |
The basic form adds it to BDEPEND, -r B+RDEPEND. Of course, no dep is |
77 |
present by default. The main difference from setting deps explicitly is |
78 |
that it permits us to do a minimal QA check between pure BDEPEND |
79 |
and B+RDEPEND for now. |
80 |
|
81 |
When all ebuilds are migrated from explicit dependencies to this method, |
82 |
we can also start detecting missing deps completely. However, that |
83 |
presumes we require using this function rather than explicit deps. |
84 |
|
85 |
Pros: |
86 |
- no pre-inherit variables |
87 |
|
88 |
Cons: |
89 |
- only partial QA check possible for the time being |
90 |
- requires migrating all ebuilds long-term |
91 |
|
92 |
|
93 |
Variant 3: leave as-is, add minimal install-qa-check.d |
94 |
====================================================== |
95 |
We can just continue adding deps manually, and add a minimal install-qa- |
96 |
check.d that greps installed scripts for entry_points usage. This will |
97 |
let us detect missing RDEPEND on setuptools but not BDEPEND. |
98 |
|
99 |
Pros: |
100 |
- no changes to ebuilds |
101 |
|
102 |
Cons: |
103 |
- only partial QA check possible |
104 |
|
105 |
|
106 |
WDYT? |
107 |
===== |
108 |
Both options have their pros and cons. I think V1 is the best since it |
109 |
avoids a common mistake, and gives full range QA check. It also doesn't |
110 |
interfere with existing deps. V2 neatly fits into the recent series but |
111 |
still requires users to remember to call it, and we can't report missing |
112 |
calls until we clean up all ebuilds. V3 provides only minimal QA |
113 |
improvement without changing the eclass. |
114 |
|
115 |
WDYT? Do you have any other ideas? |
116 |
|
117 |
-- |
118 |
Best regards, |
119 |
Michał Górny |