[Distutils] setuptools for people behind a firewall

Phillip J. Eby pje at telecommunity.com
Wed Jul 13 06:42:51 CEST 2005


At 05:49 AM 7/12/2005 -0400, Ryan Tomayko wrote:
>I think that many people running systems built on package management
>will want to setup an alternative install_dir (/usr/local/lib/ 
>pythonX.X/site-packages or perhaps /opt/pythonX.X/site-packages).
>This is why I think the only-load-pth-from-site-packages issue is
>important. Then again, wrapper scripts make it less of an issue.
>teeder-totter-teeder-totter

Keep in mind that you only have to create one .pth file per Python 
installation in order to enable this setup now.  e.g., create an 
'altinstall.pth' with this in it:

     import os,site; 
site.addsitedir(os.expanduser('~/lib/python2.X/site-packages')
     import site; site.addsitedir('/opt/python2.X/site-packages')

Those lines will not only put the other directories on sys.path, but it 
will also load all the .pth files in those directories as well.

Of course, EasyInstall won't create an easy-install.pth in the /opt 
directory or ~/lib directories, at least not until/unless it grows a 
--site-dirs option for you to use to specify alternate directories.

I could see an OS distro being set up like this, with 'altinstall.pth' in 
site-packages, and a 'distutils.cfg' file in the OS-installed distutils, 
containing something like:

     [easy_install]
     site_dirs = /opt/python2.X/site-packages, ~/lib/python2.X/site-packages

And this would basically make it so that you could install Python packages 
either site-wide or in your home directory, and still use easy-install.pth 
files.

Of course, there are problems with this setup for distros that have 
privileged programs running in Python; those programs will need to run with 
python -S (to prevent bringing in site-packages and friends) so that those 
programs can control their own environment more closely.  There are always 
trade-offs.



More information about the Distutils-SIG mailing list