~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to setup.py

  • Committer: Andrew Starr-Bochicchio
  • Date: 2014-03-30 17:59:29 UTC
  • mto: This revision was merged to the branch mainline in revision 6592.
  • Revision ID: a.starr.b@gmail.com-20140330175929-rd97jstcbau2j1gy
Use LooseVersion from distutils to check Cython version in order to handle non-integers in the version string.

Show diffs side-by-side

added added

removed removed

Lines of Context:
105
105
 
106
106
from distutils import log
107
107
from distutils.core import setup
 
108
from distutils.version import LooseVersion
108
109
from distutils.command.install_scripts import install_scripts
109
110
from distutils.command.install_data import install_data
110
111
from distutils.command.build import build
202
203
    from distutils.command.build_ext import build_ext
203
204
else:
204
205
    have_pyrex = True
205
 
    pyrex_version_info = tuple(map(int, pyrex_version.rstrip("+").split('.')))
 
206
    pyrex_version_info = LooseVersion(pyrex_version)
206
207
 
207
208
 
208
209
class build_ext_if_possible(build_ext):
299
300
                        libraries=['Ws2_32'])
300
301
    add_pyrex_extension('bzrlib._walkdirs_win32')
301
302
else:
302
 
    if have_pyrex and pyrex_version_info[:3] == (0,9,4):
 
303
    if have_pyrex and pyrex_version_info == LooseVersion("0.9.4.1"):
303
304
        # Pyrex 0.9.4.1 fails to compile this extension correctly
304
305
        # The code it generates re-uses a "local" pointer and
305
306
        # calls "PY_DECREF" after having set it to NULL. (It mixes PY_XDECREF
317
318
add_pyrex_extension('bzrlib._chk_map_pyx')
318
319
ext_modules.append(Extension('bzrlib._patiencediff_c',
319
320
                             ['bzrlib/_patiencediff_c.c']))
320
 
if have_pyrex and pyrex_version_info < (0, 9, 6, 3):
 
321
if have_pyrex and pyrex_version_info < LooseVersion("0.9.6.3"):
321
322
    print("")
322
323
    print('Your Pyrex/Cython version %s is too old to build the simple_set' % (
323
324
        pyrex_version))