1 |
Hello, |
2 |
|
3 |
The one of the worst problems which we are about to try to solve is how |
4 |
packages should depend on particular features of Python implementation. |
5 |
With three different implementations, this seems to become a bit |
6 |
problematic. |
7 |
|
8 |
First of all, I'd like to note that different Python implementations |
9 |
have different USE flags (and sometimes they even change by version). |
10 |
I've tried to find all the flags and put them in a nicely readable |
11 |
matrix here: |
12 |
|
13 |
http://wiki.gentoo.org/wiki/Python/Implementation_USE_flags |
14 |
|
15 |
Sadly, jython is mostly black magic to me and a few other flags like |
16 |
'ipv6' and 'threads' which can't be really deduced from deps as well. |
17 |
I'd really appreciate if someone could fill the table completely. |
18 |
|
19 |
The idea there is simple. If something is marked as 'flag', then |
20 |
a particular feature is optional and enabled via the listed flag. |
21 |
If it's '+', then it's always on. If it's '-', then it's not |
22 |
implemented at all. |
23 |
|
24 |
Looking at it now, there isn't yet a single flag which would be |
25 |
portable to all Python implementations. That rises the question on how |
26 |
packages should depend on features of the Python implementations. |
27 |
|
28 |
|
29 |
Secondly, I'd like you to answer the following questions which will |
30 |
determine which solutions are possible at all: |
31 |
|
32 |
Let's assume than an ebuild has optional ncurses support via |
33 |
IUSE=ncurses, and it requires ncurses module in Python. Not all Python |
34 |
implementations support ncurses. Without the USE flag, the package is |
35 |
portable to all implementations. |
36 |
|
37 |
1. Now, the user has enabled all Python implementations, |
38 |
and USE=ncurses. What should happen? |
39 |
|
40 |
a) REQUIRED_USE bailing out -- user is explicitly forced to disable |
41 |
some of the implementations locally or IUSE=ncurses; it is clear to him |
42 |
what happened; |
43 |
|
44 |
b) the package is built with implementations supporting ncurses only -- |
45 |
no explicit failure for user but then he is surprised that the package |
46 |
wasn't actually built for all impls, and he doesn't even know what |
47 |
happened. We could ewarn him, but that's a bit like reimplementing |
48 |
REQUIRED_USE. |
49 |
|
50 |
Feel free to suggest a c). |
51 |
|
52 |
2. Now, the user has enabled Jython only (the impl. without ncurses) |
53 |
and USE=ncurses. What should happen? |
54 |
|
55 |
If you have chosen a) previously, REQUIRED_USE is perfectly fine here |
56 |
as well. |
57 |
|
58 |
If you have chosen b) instead, then what now? We are either installing |
59 |
an empty package or having an inconsistent behavior. |
60 |
|
61 |
|
62 |
Now, let's get to the actual possible solutions for new python eclasses. |
63 |
|
64 |
1/ separate USE-dep variables for each implementation |
65 |
|
66 |
This is the solution suggested by hasufell: |
67 |
|
68 |
PYTHON_USEDEP="ncurses?" |
69 |
PYPY_USEDEP="ncurses?" |
70 |
JYTHON_USEDEP= # err, what exactly here? |
71 |
|
72 |
The advantage is that... errr... it works? Sadly, I'm a bit afraid it's |
73 |
like throwing a bunch of screws on the developer and saying 'now figure |
74 |
out what they may be useful for'. |
75 |
|
76 |
|
77 |
2/ a single magical variable as in python.eclass |
78 |
|
79 |
Well, it probably works... somehow. The more features we want, the more |
80 |
code we have to write. And reinvent the wheel, and remember not to lose |
81 |
compatibility when adding new features. I'd really like to avoid even |
82 |
thinking about this. |
83 |
|
84 |
|
85 |
3/ a single USE-dependency string common to all implementations |
86 |
|
87 |
Something like in my proposition of python-r1.eclass. |
88 |
|
89 |
Either: |
90 |
|
91 |
PYTHON_USEDEP='ncurses?' |
92 |
REQUIRED_USE='ncurses? ( !python_targets.... )' |
93 |
|
94 |
or: |
95 |
|
96 |
PYTHON_USEDEP='ncurses?(-)' |
97 |
|
98 |
The latter being probably incorrect wrt PMS. |
99 |
|
100 |
|
101 |
4/ a virtuals for Python features |
102 |
|
103 |
Instead of setting USE-dependency strings directly, invent a few |
104 |
virtuals like: |
105 |
|
106 |
virtual/python-ncurses: |
107 |
python_targets_python2_7? ( dev-lang/python:2.7[ncurses] ) |
108 |
... |
109 |
|
110 |
And then let ebuilds depend on them like: |
111 |
|
112 |
RDEPEND="virtual/python-ncurses[$PYTHON_USEDEP]" |
113 |
|
114 |
This solution introduces magic similar to one in 2/ while keeping it |
115 |
free of scary code. Not sure if it's really useful considering |
116 |
the REQUIRED_USE problem. |
117 |
|
118 |
We can make the virtuals add blockers for python implementations being |
119 |
enabled without the feature. But I'm not sure if it's semantically |
120 |
correct, i.e.: |
121 |
|
122 |
dev-python/foo[python_targets_jython2_5]: |
123 |
dev-java/jython:2.5 |
124 |
virtual/python-ncurses[python_targets_jython2_5]: |
125 |
!dev-java/jython:2.5 |
126 |
|
127 |
This just looks wrong ;). |
128 |
|
129 |
And it will require user to unnecessarily change flags on virtual |
130 |
itself. |
131 |
|
132 |
|
133 |
What are your opinions, ideas? |
134 |
|
135 |
-- |
136 |
Best regards, |
137 |
Michał Górny |