Gentoo Archives: gentoo-python

From: Mike Gilbert <floppym@g.o>
To: djc@g.o
Cc: gentoo-python@l.g.o
Subject: Re: [gentoo-python] Testing dev-lang/python version bumps
Date: Sat, 28 Apr 2012 17:14:48
Message-Id: 4F9C257E.1060305@gentoo.org
In Reply to: Re: [gentoo-python] Testing dev-lang/python version bumps by Mike Gilbert
1 On 04/27/2012 01:24 PM, Mike Gilbert wrote:
2 > On 04/27/2012 01:17 PM, Mike Gilbert wrote:
3 >> On 04/27/2012 12:35 PM, Dirkjan Ochtman wrote:
4 >>>>> 3. Added 61_all_process_data.patch, for which the goal seems somewhat unclear.
5 >>>> This is some logic for python-wrapper that was in the 2.7.2 patchset as
6 >>>> well. If you want to drop it, I'm sure that will require some
7 >>>> re-engineering of python-wrapper.
8 >>>
9 >>> Right. Do you know what this fixes, and how/why it will be
10 >>> re-engineered? As long as we don't know these things, I'd prefer to
11 >>> leave the patch out rather than include it.
12 >>>
13 >>
14 >> I have been bitten in the past by removing things that I don't fully
15 >> understand, so I'm trying to avoid doing that. I guess I can drop it and
16 >> see what happens.
17 >>
18 >
19 > I will add investigating this patch to my todo list. Hopefully Arfrever
20 > can explain the rationale to me, and I can relay that.
21 >
22 > Otherwise, I will have to figure it out the hard way.
23 >
24
25 Had a chat with Arfrever last night about this.
26
27 The variables introduced in 61_all_process_data.patch are there to make
28 the scripts created by python_generate_wrapper_scripts as transparent as
29 possible. Specifically, they are used to manipulate sys.argv[0] in
30 python, argv[1] in C, and the "process name" as set by
31 prctl(PR_SET_NAME, ...).
32
33 This allows /usr/bin/A (wrapper) to call /usr/bin/A-2.7 (real script),
34 but still have /usr/bin/A in sys.argv[0].
35
36 This is mainly useful for supporting python scripts which vary their
37 behavior based on sys.argv[0]. The eclean program from gentoolkit does
38 this, for example. That's probably not the best example since it does
39 not use a python.eclass generated wrapper, but it illustrates the concept.
40
41 The process name is used by utilities like killall to find the process
42 to kill. I believe it is also used in top's display.
43
44 Arfrever also claims that this should help start-stop-daemon to detect
45 which process to kill, but I have not been able to verify this claim.
46 See bug 286191 for reference.

Attachments

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