Gentoo Archives: gentoo-dev

From: Brian Harring <ferringb@×××××.com>
To: gentoo-dev@l.g.o
Cc: python@g.o
Subject: Re: [gentoo-dev] reworking python-wrapper and wrapper scripts.
Date: Thu, 18 Oct 2012 19:00:46
Message-Id: 20121018190021.GC2692@localhost.corp.google.com
In Reply to: Re: [gentoo-dev] reworking python-wrapper and wrapper scripts. by Brian Dolbec
1 On Thu, Oct 18, 2012 at 08:02:42AM -0700, Brian Dolbec wrote:
2 > On Thu, 2012-10-18 at 02:15 -0700, Brian Harring wrote:
3 > > On a related note; we currently install multiple versions of the same
4 > > script- the only difference being the shebang. If one ignores the
5 > > shebang, in some cases this is necessary- where the script is 2to3
6 > > translated, and the code for py2k vs py3k differs. For most, the only
7 > > difference is in the shebang however.
8 > >
9 >
10 > What if the invoking script is not needed to be 2to3 translated (super
11 > minimal python code) but the remaining python libs need to be?
12
13 Then we dedup 'em, using a shebang that knows to look at argv[0]'s
14 last few chars to find the appropriate python binary to invoke via.
15
16 As for the installation- either hardlinked'd scripts, or symlinked;
17 doesn't really matter, although hardlink gets my vote (so
18 sphinx-build-2.7 would be a hardlink to the same inode as
19 sphinx-build-3.2).
20
21 > > While it's minor in space savings, it's possible to eliminate that
22 > > redundancy via a shebang target that looks at the pathway it was
23 > > invoked via. Fairly easy actually, and basically zero overhead if
24 > > done.
25 > >
26 > > Either way, thoughts?
27 > >
28 > > What I'm proposing isn't perfect, but I'm of the view it's a step up
29 > > from what's in place now- and via centralizing this crap, makes it
30 > > easier to change/maintain this going forward as necessary.
31 > > ~harring
32 > >
33 >
34 > +1 from me.
35 >
36 > Eclean has been checking the name it was invoked with long before I did
37 > the major re-write. From that it cleans either distfiles or packages if
38 > invoked by either the eclean-dist or eclean-pkg symlinks. If invoked by
39 > eclean itself then it looks for the target in the arguments. So Brian's
40 > proposal is not something totally new, never been done before...
41 >
42 > While this proposes something a little different. It is still very much
43 > along the same line and in my opinion a much better solution.
44
45 Regarding "having the script check on it's own"... yeah, this has been
46 on pkgcore's todo for a while, but basically got blocked by the
47 current wrapper bits. I expect once this wrapper is in place, I may
48 screw with the setup a bit to find a way so that scripts that can
49 handle this on their own, are left to handle this on their own.
50
51 Any other +1's/-1's? Else I may do this on the weekend for
52 destress-hacking time...
53
54 ~harring