[Distutils] IBM Developerworks setuptools article - example doesnt work ?

Phillip J. Eby pje at telecommunity.com
Mon Oct 30 23:32:51 CET 2006


At 05:24 PM 10/30/2006 -0500, Michael Bayer wrote:

>On Oct 30, 2006, at 5:03 PM, Phillip J. Eby wrote:
>
>>Note, however, that if you simply build your main program as a
>>setuptools project, and define its dependencies in your setup.py,
>>then you don't need to worry about any of this; even if there is a
>>default version it can be overridden when the dependency is
>>specified using setuptools.  Most code shouldn't call require() at
>>runtime; it should just declare dependencies in a setup script,
>>making this whole question a nonissue.
>
>that is definitely interesting.  this works independently of whether - m 
>was ever used, correct ?

Yes.  When setuptools builds a script wrapper for a program, it can adjust 
sys.path while Python is starting up, to remove the default versions and 
replace them with other versions of required libraries if necessary (as 
long as the required versions are installed, that is).

Basically, when the pkg_resources module is first imported, it tries to 
satisfy all requirements using the default versions, and if there are any 
conflicts, it throws out all the defaults and builds up a new working set 
of active eggs from scratch, using available eggs from any directories on 
sys.path.



More information about the Distutils-SIG mailing list