Merge lp:~andrewsomething/bzr/lp1030521 into lp:bzr

Proposed by Andrew Starr-Bochicchio
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: no longer in the source branch.
Merged at revision: 6592
Proposed branch: lp:~andrewsomething/bzr/lp1030521
Merge into: lp:bzr
Diff against target: 78 lines (+18/-3)
3 files modified
bzrlib/tests/test_setup.py (+11/-0)
doc/en/release-notes/bzr-2.7.txt (+3/-0)
setup.py (+4/-3)
To merge this branch: bzr merge lp:~andrewsomething/bzr/lp1030521
Reviewer Review Type Date Requested Status
Vincent Ladeuil Approve
Review via email: mp+213384@code.launchpad.net

Commit message

Use LooseVersion from distutils to check Pyrex/Cython version in order to handle non-integers in the version string.

Description of the change

Use LooseVersion from distutils to check Cython version in order to handle non-integers in the version string.

To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

Thanks !

I've added a minimal test and a NEWS entry in lp:~vila/bzr/lp1030521, please review/merge/re-push here and I'll land it.

Revision history for this message
Andrew Starr-Bochicchio (andrewsomething) wrote :

Looks good. Thanks Vincent.

Revision history for this message
Vincent Ladeuil (vila) wrote :

Let's land then.

review: Approve
Revision history for this message
Vincent Ladeuil (vila) wrote :

sent to pqm by email

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'bzrlib/tests/test_setup.py'
--- bzrlib/tests/test_setup.py 2012-03-29 11:24:16 +0000
+++ bzrlib/tests/test_setup.py 2014-04-02 17:28:55 +0000
@@ -16,6 +16,7 @@
1616
17"""Test for setup.py build process"""17"""Test for setup.py build process"""
1818
19from distutils import version
19import os20import os
20import sys21import sys
21import subprocess22import subprocess
@@ -79,3 +80,13 @@
79 self.log('stderr: %r', stderr)80 self.log('stderr: %r', stderr)
80 self.assertEqual(0, p.returncode,81 self.assertEqual(0, p.returncode,
81 'invocation of %r failed' % args)82 'invocation of %r failed' % args)
83
84
85class TestDistutilsVersion(tests.TestCase):
86
87 def test_version_with_string(self):
88 # We really care about two pyrex specific versions and our ability to
89 # detect them
90 lv = version.LooseVersion
91 self.assertTrue(lv("0.9.4.1") < lv('0.17.beta1'))
92 self.assertTrue(lv("0.9.6.3") < lv('0.10'))
8293
=== modified file 'doc/en/release-notes/bzr-2.7.txt'
--- doc/en/release-notes/bzr-2.7.txt 2014-02-07 10:20:38 +0000
+++ doc/en/release-notes/bzr-2.7.txt 2014-04-02 17:28:55 +0000
@@ -36,6 +36,9 @@
36 ignore invalid references (i.e. using invalid option names) while36 ignore invalid references (i.e. using invalid option names) while
37 expanding option values. (Vincent Ladeuil, #1235099)37 expanding option values. (Vincent Ladeuil, #1235099)
3838
39* Fix pyrex version checking to be more robust.
40 (Andrew Starr-Bochicchio, #1030521 )
41
39Documentation42Documentation
40*************43*************
4144
4245
=== modified file 'setup.py'
--- setup.py 2012-02-29 12:35:23 +0000
+++ setup.py 2014-04-02 17:28:55 +0000
@@ -105,6 +105,7 @@
105105
106from distutils import log106from distutils import log
107from distutils.core import setup107from distutils.core import setup
108from distutils.version import LooseVersion
108from distutils.command.install_scripts import install_scripts109from distutils.command.install_scripts import install_scripts
109from distutils.command.install_data import install_data110from distutils.command.install_data import install_data
110from distutils.command.build import build111from distutils.command.build import build
@@ -202,7 +203,7 @@
202 from distutils.command.build_ext import build_ext203 from distutils.command.build_ext import build_ext
203else:204else:
204 have_pyrex = True205 have_pyrex = True
205 pyrex_version_info = tuple(map(int, pyrex_version.rstrip("+").split('.')))206 pyrex_version_info = LooseVersion(pyrex_version)
206207
207208
208class build_ext_if_possible(build_ext):209class build_ext_if_possible(build_ext):
@@ -299,7 +300,7 @@
299 libraries=['Ws2_32'])300 libraries=['Ws2_32'])
300 add_pyrex_extension('bzrlib._walkdirs_win32')301 add_pyrex_extension('bzrlib._walkdirs_win32')
301else:302else:
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 # Pyrex 0.9.4.1 fails to compile this extension correctly304 # Pyrex 0.9.4.1 fails to compile this extension correctly
304 # The code it generates re-uses a "local" pointer and305 # The code it generates re-uses a "local" pointer and
305 # calls "PY_DECREF" after having set it to NULL. (It mixes PY_XDECREF306 # calls "PY_DECREF" after having set it to NULL. (It mixes PY_XDECREF
@@ -317,7 +318,7 @@
317add_pyrex_extension('bzrlib._chk_map_pyx')318add_pyrex_extension('bzrlib._chk_map_pyx')
318ext_modules.append(Extension('bzrlib._patiencediff_c',319ext_modules.append(Extension('bzrlib._patiencediff_c',
319 ['bzrlib/_patiencediff_c.c']))320 ['bzrlib/_patiencediff_c.c']))
320if have_pyrex and pyrex_version_info < (0, 9, 6, 3):321if have_pyrex and pyrex_version_info < LooseVersion("0.9.6.3"):
321 print("")322 print("")
322 print('Your Pyrex/Cython version %s is too old to build the simple_set' % (323 print('Your Pyrex/Cython version %s is too old to build the simple_set' % (
323 pyrex_version))324 pyrex_version))