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
1=== modified file 'bzrlib/tests/test_setup.py'
2--- bzrlib/tests/test_setup.py 2012-03-29 11:24:16 +0000
3+++ bzrlib/tests/test_setup.py 2014-04-02 17:28:55 +0000
4@@ -16,6 +16,7 @@
5
6 """Test for setup.py build process"""
7
8+from distutils import version
9 import os
10 import sys
11 import subprocess
12@@ -79,3 +80,13 @@
13 self.log('stderr: %r', stderr)
14 self.assertEqual(0, p.returncode,
15 'invocation of %r failed' % args)
16+
17+
18+class TestDistutilsVersion(tests.TestCase):
19+
20+ def test_version_with_string(self):
21+ # We really care about two pyrex specific versions and our ability to
22+ # detect them
23+ lv = version.LooseVersion
24+ self.assertTrue(lv("0.9.4.1") < lv('0.17.beta1'))
25+ self.assertTrue(lv("0.9.6.3") < lv('0.10'))
26
27=== modified file 'doc/en/release-notes/bzr-2.7.txt'
28--- doc/en/release-notes/bzr-2.7.txt 2014-02-07 10:20:38 +0000
29+++ doc/en/release-notes/bzr-2.7.txt 2014-04-02 17:28:55 +0000
30@@ -36,6 +36,9 @@
31 ignore invalid references (i.e. using invalid option names) while
32 expanding option values. (Vincent Ladeuil, #1235099)
33
34+* Fix pyrex version checking to be more robust.
35+ (Andrew Starr-Bochicchio, #1030521 )
36+
37 Documentation
38 *************
39
40
41=== modified file 'setup.py'
42--- setup.py 2012-02-29 12:35:23 +0000
43+++ setup.py 2014-04-02 17:28:55 +0000
44@@ -105,6 +105,7 @@
45
46 from distutils import log
47 from distutils.core import setup
48+from distutils.version import LooseVersion
49 from distutils.command.install_scripts import install_scripts
50 from distutils.command.install_data import install_data
51 from distutils.command.build import build
52@@ -202,7 +203,7 @@
53 from distutils.command.build_ext import build_ext
54 else:
55 have_pyrex = True
56- pyrex_version_info = tuple(map(int, pyrex_version.rstrip("+").split('.')))
57+ pyrex_version_info = LooseVersion(pyrex_version)
58
59
60 class build_ext_if_possible(build_ext):
61@@ -299,7 +300,7 @@
62 libraries=['Ws2_32'])
63 add_pyrex_extension('bzrlib._walkdirs_win32')
64 else:
65- if have_pyrex and pyrex_version_info[:3] == (0,9,4):
66+ if have_pyrex and pyrex_version_info == LooseVersion("0.9.4.1"):
67 # Pyrex 0.9.4.1 fails to compile this extension correctly
68 # The code it generates re-uses a "local" pointer and
69 # calls "PY_DECREF" after having set it to NULL. (It mixes PY_XDECREF
70@@ -317,7 +318,7 @@
71 add_pyrex_extension('bzrlib._chk_map_pyx')
72 ext_modules.append(Extension('bzrlib._patiencediff_c',
73 ['bzrlib/_patiencediff_c.c']))
74-if have_pyrex and pyrex_version_info < (0, 9, 6, 3):
75+if have_pyrex and pyrex_version_info < LooseVersion("0.9.6.3"):
76 print("")
77 print('Your Pyrex/Cython version %s is too old to build the simple_set' % (
78 pyrex_version))