Gentoo Archives: gentoo-dev

From: Peter Volkov <pva@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Versioning of Python scripts
Date: Tue, 22 Dec 2009 09:07:27
Message-Id: 1261472689.4326.25.camel@tablet
In Reply to: [gentoo-dev] Versioning of Python scripts by Arfrever Frehtes Taifersar Arahesis
1 В Сбт, 19/12/2009 в 16:24 +0100, Arfrever Frehtes Taifersar Arahesis
2 пишет:
3 > - Scripts of packages supporting only e.g. Python 2 can be executed (without necessity
4 > of using of e.g. "python2 /usr/bin/${script}") after activating of e.g. Python 3.
5 > - Scripts of packages supporting multiple Python versions ignore active Python version.
6
7 > The best solution, which removes these 2 disadvantages and preserves the advantage, seems
8 > to be to rename Python scripts to include Python version [1] in filenames, and create wrapper
9 > scripts, which call appropriate target scripts [2].
10
11 But still additional wrapper scripts and increased number of scripts in
12 total is not really nice. What do you think about another solution:
13
14 Separate possible script's python API versions into database, e.g.
15 in /var/db/pyabi/${CATEGORY}/${PN}-${SLOT}. Create python wrapper only
16 for unmerged but still in use (found from pyabi db) python versions,
17 e.g. /usr/bin/python3.2 in case you've unmerged python, but scripts
18 still reference python3.2.
19
20 This way scripts that use python versions that are still in the tree
21 will work without any overhead, fewer scripts in /{usr,}bin and during
22 python merge/unmerge it is possible to warn user about scripts that use
23 unmerged python versions (and thus run with some overhead). I guess
24 still we can add some user defined variable to prefer some python
25 versions over another...
26
27 > - Scripts of packages supporting multiple Python versions cannot be easily (without
28 > necessity of using of e.g. "python3.1 /usr/bin/${script}") executed with a Python
29 > version different than active Python version.
30
31 If you develop on python then... write your own wrappers or
32 use /usr/bin/python and that's it! In case you are not I'm not sure why
33 such switching is useful. Could you elaborate?
34
35 --
36 Peter.