[Distutils] Setting distutils options from sitecustomize

Phillip J. Eby pje at telecommunity.com
Thu Jan 26 22:34:51 CET 2006

At 12:09 PM 1/23/2006 -0600, Ian Bicking wrote:
>Has anyone tried anything that involves setting the distutils options
>(e.g., where to install libraries) from sitecustomize or some other
>Python location?  I want to put in logic that is more complex than can
>be expressed in a configuration file.  Setuptools-specific is a-ok too.

The standard way to do this with the distutils would be to create custom 
versions of the commands, or subclass Distribution in order to slap in some 
extra configuration.  For example, you could add to what configuration 
files get loaded.

Of course, that doesn't help you much for affecting *other* people's setup 
scripts.  :)  Probably a way to do this in a future version of setuptools 
would be for me to add a lot more entry points that get run at various 
phases of a setup script's operation, like when the Distribution loads up 
configuration files or something.

>Jim Fulton asked about something similar on IRC too -- actually about
>having an easy_install binary that installed to a different location
>than normal (to the Zope instance path).

A trivial way to do this currently would be to create a wrapper that 
changed the current directory to a directory with a custom setup.cfg in it, 
then ran easy_install.  Another way would be to set the HOME environment 
variable instead, to point to a directory with a ".pydistutils.cfg" in it, 
although that might lead to other issues.

More information about the Distutils-SIG mailing list