1 |
Apparently, though unproven, at 02:30 on Thursday 19 May 2011, Dale did opine |
2 |
thusly: |
3 |
|
4 |
> I have a quick question. I sync'd a bit ago and noticed something a bit |
5 |
> odd. Here it is: |
6 |
> |
7 |
> [ebuild U *] sys-apps/portage-2.2.0_alpha34 [2.2.0_alpha33] |
8 |
> USE="(ipc) -build -doc -epydoc -python2 -python3 (-selinux)" |
9 |
> LINGUAS="-pl" 794 kB |
10 |
> |
11 |
> I know portage needs python but check out the USE flags. Both python2 |
12 |
> and python3 are disabled. Shouldn't one of those be enabled? Even |
13 |
> better, shouldn't portage complain a bit about this before emerging? |
14 |
> Thing is, I'm tempted to enable them both. 2.7 is currently being used |
15 |
> but won't 3.1 be used eventually? Should I enable both or just emerge as |
16 |
> is? |
17 |
> |
18 |
> That is the unstable version so if this is a problem, I want to file a |
19 |
> bug before someone else runs into this and ends up with a borked system. |
20 |
|
21 |
The solution, as always, is in the ebuild. But first a clarification: |
22 |
|
23 |
USE flags are NOT some scheme where support will or will not be built, or that |
24 |
other packages will be magically removed somehow. They are programming |
25 |
variables and are used as such. Inside the ebuild, the code looks at the flag |
26 |
and does something with it. Usually it does what you expect: |
27 |
|
28 |
python_dep="python3? ( =dev-lang/python-3* ) |
29 |
!python2? ( !python3? ( |
30 |
build? ( || ( dev-lang/python:2.7 dev-lang/python:2.6 ) ) |
31 |
!build? ( || ( dev-lang/python:2.7 dev-lang/python:2.6 >=dev- |
32 |
lang/python-3 ) ) |
33 |
) ) |
34 |
python2? ( !python3? ( || ( dev-lang/python:2.7 dev-lang/python:2.6 ) |
35 |
) )" |
36 |
|
37 |
What that basically comes down to (2nd and 3rd cases swapped for clarity) is: |
38 |
|
39 |
python3 is set = require python-3 |
40 |
python2 is set and python3 is not set = require python-2.6 or python-2.7 |
41 |
python2 is not set python3 is not set = require python-2.6 or python-2.7 |
42 |
|
43 |
Elsewhere is the ebuild you get stuff like this: |
44 |
|
45 |
if use python3; then |
46 |
python_set_active_version 3 |
47 |
elif use python2; then |
48 |
python_set_active_version 2 |
49 |
|
50 |
Which basically means "always set active version to python-2.x regardless of |
51 |
anything else unless USE=python-3, in which case set the active version to |
52 |
python-3. |
53 |
|
54 |
So, no bug here, nothing to see, move along folks. |
55 |
|
56 |
|
57 |
-- |
58 |
alan dot mckinnon at gmail dot com |