Gentoo Archives: gentoo-python

From: "Michał Górny" <mgorny@g.o>
To: Brian Harring <ferringb@×××××.com>
Cc: Mike Gilbert <floppym@g.o>, gentoo-python@l.g.o
Subject: Re: [gentoo-python] Re: [PATCH eselect-python 1/2] Store per-version interpreter preference in a file as well.
Date: Fri, 02 Nov 2012 09:02:28
Message-Id: 20121102100305.4acfc927@pomiocik.lan
In Reply to: Re: [gentoo-python] Re: [PATCH eselect-python 1/2] Store per-version interpreter preference in a file as well. by Brian Harring
1 On Thu, 1 Nov 2012 15:42:42 -0700
2 Brian Harring <ferringb@×××××.com> wrote:
3
4 > On Thu, Nov 01, 2012 at 10:27:19PM +0100, Micha?? G??rny wrote:
5 > > On Thu, 1 Nov 2012 14:48:55 -0400
6 > > Mike Gilbert <floppym@g.o> wrote:
7 > >
8 > > > On Thu, Nov 1, 2012 at 11:44 AM, Mike Gilbert <floppymaster@×××××.com> wrote:
9 > > > > On Thu, Nov 1, 2012 at 7:54 AM, Micha?? G??rny <mgorny@g.o> wrote:
10 > > > >> The idea is very simple: /etc/env.d/python/python[23] with a one-line
11 > > > >> value similar to the main interpreter /config file.
12 > > > >>
13 > > > >> That should be simpler & more reliable than reading a symlink. And at
14 > > > >> some point we can replace the symlink with an $EPYTHON-aware wrapper
15 > > > >> as well.
16 > > > >
17 > > > > I don't understand the point of this. Do we have some need to enable
18 > > > > EPYTHON usages for scripts that have a python2 or python3 shebang?
19 > > > >
20 > > > > I also don't understand how a text file is more reliable than a
21 > > > > symlink; they are basically the same thing, but the symlink has a
22 > > > > different file mode.
23 > >
24 > > Ah, and I'd forget. I have the following dream:
25 > >
26 > > /etc/env.d/python/python2
27 > > /etc/env.d/python/python3
28 > > /etc/env.d/python/config -> python2
29 > >
30 > > So, python{2,3} keep the per-version interpreters, and config is just
31 > > a symlink to one of them. Two bird with one stone -- readlink to get
32 > > which group is enabled, cat to get the exact interpreter. I'm proud
33 > > of myself!
34 >
35 > I too have a dream; git://pkgcore.org/eslect-python .
36 >
37 > That's a shebang based version of what I proposed a while back. It
38 > works now and has tests. It's written to be basically a drop in for
39 > existing python.eclass generation of shebangs, w/ the
40 > hardlinking/de-duplication/farking-fast/fix python3.2
41 > /usr/bin/sphinx-build scenario.
42
43 Could you please provide an explanation of what it does? I mean, a few
44 points of what happens when you run it in various scenarios. That's 600
45 lines of C code, I think Python folks would appreciate not having to
46 read that line by line.
47
48 > The remaining work for that is thus:
49 >
50 > 1) If the EPYTHON targets aren't given via shebang arg, then it needs
51 > to fallback to grabbing the targets from the file (easy enough).
52 >
53 > 2) Add a few helpers/wrappers to make it easier to do the
54 > deduplication/shebang rewriting.
55
56 How would you perform deduplication while you're at it? Could you
57 measure or at least consider the benefits of it?
58
59 > Frankly, you should be looking at this imo, rather than trying
60 > standalone files. Yes, files is simpler- but you'll wind up sooner or
61 > later rebuilding it into what I already built out here.
62
63 I think you are missing the point I'm raising here. Mostly because your
64 python-wrapper doesn't handle per-version preferences like python-exec
65 does, unless I'm missing something.
66
67 > """
68 > Add a python-shebang utility, slave python-wrapper to it.
69 >
70 > Going forward, the intent is to push the PYTHON_ABIs of a given
71 > script down into it's shebang, pointing the shebang at python-shebang.
72 >
73 > In this way, all known/supported abi's are available at the time of
74 > execution; further, if the target is told to respect-EPYTHON (meaning
75 > no searching for something to execute, either active python version or
76 > EPYTHON var), we can push this down into that list and have that code
77 > handle it.
78 >
79 > [...]
80 >
81 > to the simpler form of:
82 > for x in sphinx{,-{2.7,3.2}}; do echo > $x <<EOF
83 > #!/usr/bin/python-shebang python2.7,python3.2
84 > <code>
85 > EOF
86 > done
87
88 Hmm, are you assuming that /usr/bin/sphinx carries the actual code?
89 Or some special wrapper code?
90
91 Not to mention you still bind the whole thing to installed package.
92 If you need to fix those files, you need to reinstall all packages
93 installing them.
94
95 > The gains of this are thus:
96
97 Could you please compare it to the modern solution (python-exec) rather
98 than the deprecated one? You are no longer on the uncharted waters.
99
100 --
101 Best regards,
102 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies