[Python-Dev] Python and the Linux Standard Base (LSB)

Barry Warsaw barry at python.org
Wed Nov 29 00:41:37 CET 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Nov 28, 2006, at 4:19 PM, Phillip J. Eby wrote:

> At 01:05 PM 11/28/2006 -0800, Guido van Rossum wrote:
>> On 11/28/06, Barry Warsaw <barry at python.org> wrote:
>> > There's a related issue that may or may not be in scope for this
>> > thread.  For distros like Gentoo or Ubuntu that rely heavily on  
>> their
>> > own system Python for the OS to work properly, I'm quite loathe to
>> > install Cheeseshop packages into the system site-packages.
>>
>> I wonder if would help if we were to add a vendor-packages directory
>> where distros can put their own selection of 3rd party stuff they
>> depend on, to be searched before site-packages, and a command-line
>> switch that ignores site-package but still searches vendor-package.
>> (-S would almost do it but probably suppresses too  much.)
>
> They could also use -S and then explicitly insert the vendor- 
> packages directory into sys.path at the beginning of their scripts.

Possibly, but stuff like this can be a pain because your dependent  
app must build in the infrastructure itself to get the right paths  
set up for its scripts.  An approach I've used in the past is to put  
a paths.py file in the bin directory and force every script to  
"import paths" before it imports anything it doesn't want to get from  
the stdlib (including overrides).  paths.py is actually generated  
though because the user could specify an alternative Python with a  
configure switch.

What I'm moving to now though is a sort of 'shell' or driver script  
which does that path setup once, then imports a module based on argv 
[0], sniffing out a main() and then calling that.  The trick then of  
course is that you symlink all the top-level user scripts to this  
shell.  Works fine if all you care about is *nix <wink>, but it does  
mean an application with lots of entry-level scripts has to build all  
this infrastructure itself.

Maybe there's no better way of doing this and applications are best  
left to their own devices.  But in the back of my mind, I keep  
thinking there should be a better way. ;)

- -Barry

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iQCVAwUBRWzJMXEjvBPtnXfVAQJHmAP/UhGUv1Wxt2AzGT08dM9/M0J4pahGnrF3
VwbrdRTF6Jt32iAKAJolrnTE+XlMaTGitYv+mu8v3SgJLWwe+aeJwpg8AdOn5jBL
bSjBpE9UeqUSiMhaJmBbx/z5ISv4OioJLX+vzBv6u0yBTYv4uoYZPKoeMcCe6Afw
7e1gIL1WHL4=
=scvm
-----END PGP SIGNATURE-----


More information about the Python-Dev mailing list