[Distutils] setuptools - what if a library is required but is in the standard lib?

Phillip J. Eby pje at telecommunity.com
Thu Feb 7 19:38:15 CET 2008


At 04:55 PM 2/7/2008 +0000, Chris Withers wrote:
>Hi All,
>
>If I mark my package as requiring wsgiref, will it still be 
>downloaded if someone is using python 2.5?

Only if someone messed with Python's default build structure.  The 
Python stdlib should contain an .egg-info file marking the presence 
of wsgiref 0.1.2.  Some Linux distributions may remove this file due 
to a misunderstanding of its nature/purpose.

Note that this is specific to wsgiref, and doesn't apply to any other 
separately-distributed packages bundled with 2.5, such as sqlite or 
ctypes.  For these, you'll need to do version checking as described below.


>If yes, how do I write my setup.py such that it's only required if 
>the installer is using python 2.4 or less?

requires = [...]
if sys.version < "2.5":
     requires.append('wsgiref>=0.1.2')

setup(
     ...
     install_requires = requires
)



More information about the Distutils-SIG mailing list