[Distutils] requiring python 2.5

Phillip J. Eby pje at telecommunity.com
Tue Jun 5 22:58:21 CEST 2007


At 01:03 PM 6/5/2007 -0400, Ryan O'Neil wrote:
>My apologies if this was already covered; I couldn't find appropriate
>mention of the issue.
>
>What is the best way to require Python 2.5 in setuptools?  In PyGEP
>0.1.2 I did the following:
>
>     setup(
>         # --- snip ---
>         install_requires = ['python>=2.5'],
>         # --- snip ---
>     )
>
>This worked wonderfully on Linux using setuptools 0.6c5, but on
>Windows (also with Python 2.5 and setuptools 0.6c5), it couldn't
>recognize the installed version of Python and tried to download and
>compile it (python) from source.

Interesting; it sounds like there might be a problem with what files 
are being installed on Windows; Python 2.5 is supposed to include a 
Python.egg-info file that indicates Python 2.5 is installed.

However, it's probably the case that EasyInstall should not try to 
install Python from source, regardless.  :)


>I was able to get things mostly working by getting rid of the
>install_requires line and adding this code to my setup.py:
>
>     import sys
>
>     if sys.version_info[:2] < (2, 5):
>         raise Exception('PyGEP requires Python 2.5')

I'd recommend using either a DistutilsError subclass or SystemExit; 
both will be handled more gracefully by easy_install.


>However, easy_install will now download PyGEP for Python 2.4 and fail
>during setup, which is less than ideal (and ends up with cheesecaking
>slandering its installability ;).  Am I just doing everything
>completely wrong?

No; at the moment the infrastructure for requiring a particular 
version of Python just isn't that great.



More information about the Distutils-SIG mailing list