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
In Reply to: Re: [gentoo-python] Testing dev-lang/python version bumps by Mike Gilbert
On 04/27/2012 01:24 PM, Mike Gilbert wrote:
> On 04/27/2012 01:17 PM, Mike Gilbert wrote: >> On 04/27/2012 12:35 PM, Dirkjan Ochtman wrote: >>>>> 3. Added 61_all_process_data.patch, for which the goal seems somewhat unclear. >>>> This is some logic for python-wrapper that was in the 2.7.2 patchset as >>>> well. If you want to drop it, I'm sure that will require some >>>> re-engineering of python-wrapper. >>> >>> Right. Do you know what this fixes, and how/why it will be >>> re-engineered? As long as we don't know these things, I'd prefer to >>> leave the patch out rather than include it. >>> >> >> I have been bitten in the past by removing things that I don't fully >> understand, so I'm trying to avoid doing that. I guess I can drop it and >> see what happens. >> > > I will add investigating this patch to my todo list. Hopefully Arfrever > can explain the rationale to me, and I can relay that. > > Otherwise, I will have to figure it out the hard way. >
Had a chat with Arfrever last night about this. The variables introduced in 61_all_process_data.patch are there to make the scripts created by python_generate_wrapper_scripts as transparent as possible. Specifically, they are used to manipulate sys.argv[0] in python, argv[1] in C, and the "process name" as set by prctl(PR_SET_NAME, ...). This allows /usr/bin/A (wrapper) to call /usr/bin/A-2.7 (real script), but still have /usr/bin/A in sys.argv[0]. This is mainly useful for supporting python scripts which vary their behavior based on sys.argv[0]. The eclean program from gentoolkit does this, for example. That's probably not the best example since it does not use a python.eclass generated wrapper, but it illustrates the concept. The process name is used by utilities like killall to find the process to kill. I believe it is also used in top's display. Arfrever also claims that this should help start-stop-daemon to detect which process to kill, but I have not been able to verify this claim. See bug 286191 for reference.


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