1 |
2009-09-20 19:47:28 Nirbheek Chauhan napisaĆ(a): |
2 |
> On Sun, Sep 20, 2009 at 11:05 PM, Arfrever Frehtes Taifersar Arahesis |
3 |
> <Arfrever@g.o> wrote: |
4 |
> >> Package X (stable) requires python-2 |
5 |
> >> Package Y (stable) requires python-3 |
6 |
> >> |
7 |
> >> => User can't use both at the same time. |
8 |
> > |
9 |
> > Distribute/Setuptools will ensure that appropriate shebang is present in Python |
10 |
> > scripts. In other cases, we can easily modify shebangs in installed scripts. |
11 |
> > (A new function in python.eclass could be created for this purpose, but until |
12 |
> > now it isn't needed.) |
13 |
> > |
14 |
> |
15 |
> Oooh, this will lead to more phun! |
16 |
> |
17 |
> Package A (module, stable) requires python-3 |
18 |
> |
19 |
> However, A is a dependency of *both* X and Y |
20 |
> |
21 |
> Now what? Slotting? Install to both/all python prefixes? Or some other |
22 |
> ugly solution? |
23 |
|
24 |
There is a difference between Python scripts and Python modules. |
25 |
|
26 |
Python scripts should have shebang and this shebang is used to decide |
27 |
which interpreter should be used when './script.py' is called. But it |
28 |
is possible to call Python scripts using 'pythonX.Y script.py' which |
29 |
will enforce using of pythonX.Y instead of interpreter specified in |
30 |
shebang in this script. When one Python script executes another Python |
31 |
script (using e.g. subprocess.Popen()) then both scripts will work |
32 |
correctly even when they have different shebangs. |
33 |
|
34 |
Python modules shouldn't have shebang. Python modules are intended to |
35 |
be imported from Python scripts or other Python modules. Any shebang |
36 |
in a Python module is ignored, when this module is imported using 'import' |
37 |
statement. |
38 |
|
39 |
The chance that well known and often used Python modules start |
40 |
unconditionally require Python 3 in the near future is small, but |
41 |
Python scripts can safely do it. |
42 |
|
43 |
For example PyQt4 supports both Python 2 and 3, but a useful script, which |
44 |
uses PyQt4, might require Python 3. |
45 |
|
46 |
> Seriously, if you *really* *really* want python-3 stable, it should: |
47 |
> |
48 |
> 1) NOT show up in `eselect python` to set as the default interpreter |
49 |
|
50 |
When a user wants to work for an hour with a script requiring Python 3, |
51 |
and doesn't want to use e.g. Portage during this time, then it is |
52 |
reasonable to run 'eselect python set python3.1' once and be able |
53 |
to just use './script.py' instead of having to type 'python3.1 script.py' |
54 |
every time. Next this user can switch active Python back to 2.6. |
55 |
|
56 |
> 2) NOT be a dependency of any package in stable |
57 |
|
58 |
It isn't implementable without having to change dependencies in hundreds |
59 |
of packages. There is nothing wrong in having Python 3 installed which |
60 |
would use small amount of disk space. |
61 |
|
62 |
-- |
63 |
Arfrever Frehtes Taifersar Arahesis |