1 |
On czw, 2017-04-20 at 13:28 +0700, grozin@g.o wrote: |
2 |
> Many thanks to the python team for good work. |
3 |
> |
4 |
> In some cases a package installs some script(s) which run python |
5 |
> interpreter. I mean IDE-like packages, e.g., spyder, bpython, ptpython, |
6 |
> etc. A user may want to run either python2 or python3 using such IDE. The |
7 |
> "standard" behaviour is to install a single script which runs python2 or |
8 |
> python3 depending on eselect python. In the case of spyder, there was a |
9 |
> user who insisted that he wants to use spyder for python2 *and* python3, |
10 |
> without changing the global eselect python setting. I've changed the |
11 |
> ebuild to install 3 scripts: spyder (behaves as above), spyder2, and |
12 |
> spyder3. The same may be useful for bpython, ptpython, and, maybe, some |
13 |
> other packages. Are there plans to make this task easy and systematic, |
14 |
> without re-inventing the wheel in each ebuild? |
15 |
> |
16 |
|
17 |
Well, your explanation seemed a little bit unclear to me, so I'd like to |
18 |
clarify first. I presume you mean creating additional 'wrappers' that |
19 |
start the package with a specific implementation; i.e. in spyder, you |
20 |
have: |
21 |
|
22 |
python_newscript scripts/${PN} ${PN}${EPYTHON:6:1} |
23 |
|
24 |
For this thing, I don't think it really beneficial to provide additional |
25 |
methods. In most cases where this is really useful, upstream already |
26 |
creates additional names, and the eclasses handle wrapping them just |
27 |
fine. |
28 |
|
29 |
Doing it causes a few problems: how to name them? How detailed should |
30 |
they be? I.e. if it should be just spyder2 and spyder3, or maybe |
31 |
spyder2.7, spyder3.4, spyder3.5... How to handle pypy/pypy3? This |
32 |
usually quite sucks, and I don't want the eclass to make arbitrary |
33 |
guesses about that. |
34 |
|
35 |
That said, you could make your code pypy-safer if you did: |
36 |
|
37 |
local suffix |
38 |
python_is_python3 && suffix=3 || suffix=2 |
39 |
python_newscript scripts/${PN} ${PN}${suffix} |
40 |
|
41 |
Plus, the user can set EPYTHON to alter the implementation without using |
42 |
eselect. Or run scripts directly from /usr/lib/python-exec/*. I should |
43 |
probably add that to the python-exec doc [1]. It's possible it's already |
44 |
somewhere in the docs but I can't find it ;-). |
45 |
|
46 |
[1]:https://wiki.gentoo.org/wiki/Project:Python/python-exec |
47 |
|
48 |
-- |
49 |
Best regards, |
50 |
Michał Górny |