[Distutils] setuptools: can I specify different install_requires for different python versions?

P.J. Eby pje at telecommunity.com
Tue Jul 28 22:00:44 CEST 2009


At 12:38 PM 7/28/2009 -0700, Sridhar Ratnakumar wrote:
>On Tue, 28 Jul 2009 12:26:52 -0700, P.J. Eby <pje at telecommunity.com> wrote:
>
>>At 03:04 PM 7/28/2009 -0400, Matthew Wilson wrote:
>>I have a package that depends on the multiprocessing package, which
>>got added to the standard library as of 2.6.
>>  So, for only those people using python versions before 2.6, I want to
>>require they install multiprocessing.
>>  Is this possible?
>>  Yes.  Write your setup.py to check the Python version, and build up the
>>requirements in a variable before calling setup().
>
>I'm -1 on this solution.

Please note that *future* fixes won't help the person who asked what 
to do right now.


>[1] One way to implement conditional requirements is to make use of
>Requirement.extras. If setuptools/distribute supports builtin extras -
>such as Py26, Py27, Py30 and so forth .. even Py3x to cover all 3.x
>versions - then one can have a [<Py26] section in their install_requires
>that would specify requirements specific to versions below 2.6.

It would also need to support platform-specific requirements, and 
possibly other options as well.


>which, however, means one has to run
>setup.py with all its silly hacks (raw_input() anyone?).

Ew.  Somebody actually did that?  Please identify the culprit so they 
can be publicly shamed.



More information about the Distutils-SIG mailing list