Gentoo Archives: gentoo-python

From: Brian Harring <ferringb@×××××.com>
To: Mike Gilbert <floppym@g.o>
Cc: Micha?? G??rny <mgorny@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: Sat, 03 Nov 2012 21:31:25
Message-Id: 20121103213112.GB3150@localhost
In Reply to: Re: [gentoo-python] Re: [PATCH eselect-python 1/2] Store per-version interpreter preference in a file as well. by Mike Gilbert
1 On Sat, Nov 03, 2012 at 11:55:37AM -0400, Mike Gilbert wrote:
2 > On Sat, Nov 3, 2012 at 7:47 AM, Brian Harring <ferringb@×××××.com> wrote:
3 >
4 > Some quick notes on these last points. Don't get too hung up on this;
5 > my general opinion of the solution follows at the end.
6 >
7 > > Your implementation mandates the following:
8 > >
9 > > *) scripts be changed from sphinx-build-2.7 to sphinx-build-python2.7.
10 > >
11 >
12 > The was a design decision to simplify the implementation in
13 > conjunction with the new eclass and avoids having to map a plain
14 > number (2.7) to an actual interpreter name (python2.7). I still like
15 > this idea, but it really isn't safe to do this in the old eclass.
16
17 Renaming sphinx-build-2.7-pypy-1.8 to sphinx-build-pypy-c1.8 (or just
18 1.8) personally I think is sane; the original naming was off, and I
19 doubt any code actually hardcodes it.
20
21 I don't see the point in shoving -pythonx.y when -x.y
22 suffices however- the parsing scenario there is easy to handle for
23 any wrapper, and is understood for folks these days.
24
25 Additionally, because the advocated route of forcing a specific interp
26 for a target has thus been invoking the interpretter specific script
27 (sphinx-build-2.7 for example), changing the name for python means
28 breakage may occur.
29
30 How much breakage, I've no clue; just pointing out that it is
31 possible.
32
33
34 > > *) mandates symlinks of python-EPYTHON were it to be attempted to be
35 > > used for python-wrapper.
36 > >
37 >
38 > python-exec was not originally intended to replace python-wrapper so
39 > there is no code in place to handle this more gracefully.
40
41 It was proposed, which is why I responded to it.
42
43 Same angle, the cons of python-exec compared to python-shebang were
44 asked, so this got brought up. python-wrapper is literally just a a
45 simple re-exec around python-shebang now.
46
47
48 > > Python herd, assuming you've not ignored the thread due to the noise,
49 > > your views would be useful.
50 >
51 > Just so everyone is on the same page here: python-exec was invented as
52 > an answer to the problem of how to implement script wrappers in the
53 > new eclass. The new eclass(es) were invented because nobody wanted to
54 > make significant modifications to the old one, given its complexity
55 > and code style.
56 >
57 > I don't think we were aiming for a perfect solution with python-r1 and
58 > python-exec, rather one that was simple so people could understand,
59 > and worked in the cases we considered at the time.
60 >
61 > Your main goal with python-shebang seems to be a fix to the "python2.7
62 > /usr/bin/sphinx-build" thing, which is fine. But it lead you to a
63 > different place.
64
65 Close; my main goal was replacing that fucking python wrapper, and
66 fixing `python2.7 /usr/bin/sphinx-build` while speeding everything up.
67
68 I've got a couple of core requirements, but they pretty much sum up to
69 "the existing wrapper needs to die"- everything else (de-duplication
70 reducing the number of files on disk) is icing on the cake.
71
72
73 > That said, I like this python-shebang solution, and your replies to
74 > mgorny's questions have provided very useful insight.
75 >
76 > However, I have a few issues:
77 >
78 > 1. I still don't really understand the guts of python-shebang.
79 >
80 > It's a significant chunk of C that is doing things I am not yet
81 > familiar with. I'm sure I can figure it out if I take some time, but
82 > right now I have a "fear of the unknown" thing happening in my head.
83 >
84 > I don't want us to end up with only you understanding how to modify that code.
85
86 That can be rectified via more comments. Honestly it's pretty simple-
87 just trace the main(); everything else is just helpers to it. The
88 flow there should be pretty clear as to what it's doing.
89
90 The actual invocation scenarios, and details of how it covers each of
91 those, can be addressed via a README (or similar) easily enough.
92 There's a few subtlies there as to how it manages to do the correct
93 thing, which I should document.
94
95
96 > 2. Somebody needs to write the python.eclass code if we really want to go there.
97 >
98 > I think we would need to modify
99 > python_merge_intermediate_installation_images, and replace
100 > python_generate_wrapper_scripts. If anyone wants to take a crack at
101 > it, great.
102
103 Already have local patches to that effect; as indicated in my original
104 email, I'm busy with some other things atm, but I'll loop back to it
105 in the next week or two.
106
107 If someone else wants to finish it, they're free to. Else I will.
108
109
110 > 3. We need to reconcile the script naming convention so we can use
111 > this with the new eclass as well.
112 >
113 > I just don't see us implementing PYTHON_TARGETS in python.eclass. I
114 > have considered it, but I just don't have the motivation to do it. I
115 > still think we are going to proceed with the python-r1 effort.
116 >
117 > What do you think about extending python-shebang to understand the
118 > script-$EPYTHON naming convention in addition to the
119 > script-$PYTHON_ABI convention? I only ask because I dislike the
120 > $PYTHON_ABI values and would rather not see that re-implemented in
121 > python-r1. I think script-$EPYTHON gives a clearer indication as to
122 > its intended purpose anyway.
123
124 Off the top of the head, it's easy enough to support both w/
125 python-shebang code; it's just an extra case or two for the core
126 parsing.
127
128 I *do* intend to keep the current parsing in place though- as I said,
129 I want this idiocy fixed in python.eclass now (and as demonstrated,
130 I'll do the work myself if necessary). Removing that blob of code out
131 of python.eclass won't fix the eclass, but it'll at least bring down
132 the line count a bit so there's less to have to work with.
133
134 Plus if a replacement actual ground, this component doesn't need
135 changing (if it ain't broke, don't fix it).
136
137 ~harring