how do you express a platform-specific dependency?

Folks: 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? Regards, Zooko [1] http://pypi.python.org/pypi/Twisted [2] http://twistedmatrix.com/trac/browser/trunk/setup.py?rev=23010#L76

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

At 04:15 PM 5/15/2008 -0600, zooko wrote:
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?
Yes... but when you test or install from a source distribution, those files get rebuilt. And of course, the binary distributions are platform-specific.
participants (2)
-
Phillip J. Eby
-
zooko