[Distutils] how do you express a platform-specific dependency?

zooko zooko at zooko.com
Fri May 16 00:15:17 CEST 2008


On May 15, 2008, at 4:01 PM, zooko wrote:

> Twisted requires pywin32 if it is running on Windows.  How can the  
> twisted package metadata [1], which is produced by the twisted  
> setup.py [2], specify this dependency so that if you easy_install  
> Twisted on Windows you'll get pywin32 as well, but if you  
> easy_install Twisted on another platform you won't?
...
> [1] http://pypi.python.org/pypi/Twisted
> [2] http://twistedmatrix.com/trac/browser/trunk/setup.py?rev=23010#L76

Oh, following up to my own post, I guess the way you do it is put

if sys.platform == 'win32':
     requirements.append('pywin32')

If you do an install which involves fetching and evaluating the  
setup.py, this will suffice.  What I don't understand is what happens  
if declarative metadata is generated, e.g. a "twisted.egg-info/ 
requires.txt" file which lists requirements.  Will that file contain  
"pywin32" if Twisted was built on Windows but not if it was built  
elsewhere?  Do those files get transferred around, such as in source  
distributions?

Thanks,

Regards,

Zooko



More information about the Distutils-SIG mailing list