Merge lp:~andrea-crotti-0/mailman/version into lp:mailman

Proposed by Andrea Crotti
Status: Rejected
Rejected by: Barry Warsaw
Proposed branch: lp:~andrea-crotti-0/mailman/version
Merge into: lp:mailman
Diff against target: 33 lines (+5/-12)
1 file modified
setup.py (+5/-12)
To merge this branch: bzr merge lp:~andrea-crotti-0/mailman/version
Reviewer Review Type Date Requested Status
Barry Warsaw Disapprove
Review via email: mp+97258@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Barry Warsaw (barry) wrote :

Sorry, I'm going to reject this branch since I've set the bug to Won't Fix. Thanks for your contribution though!

review: Disapprove

Unmerged revisions

7111. By Andrea Crotti

avoid using regular expressions to look inside the version.py file,
and simply use execfile, which should be allowed to blow up if
something goes wrong in that stage

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'setup.py'
2--- setup.py 2012-01-01 19:14:46 +0000
3+++ setup.py 2012-03-13 17:20:46 +0000
4@@ -18,27 +18,20 @@
5 from distribute_setup import use_setuptools
6 use_setuptools()
7
8-import re
9 import sys
10
11 from setuptools import setup, find_packages
12 from string import Template
13
14-if sys.hexversion < 0x20600f0:
15+if sys.version < '2.6':
16 print 'Mailman requires at least Python 2.6'
17 sys.exit(1)
18
19
20-# Calculate the version number without importing the mailman package.
21-with open('src/mailman/version.py') as fp:
22- for line in fp:
23- mo = re.match("VERSION = '(?P<version>[^']+?)'", line)
24- if mo:
25- __version__ = mo.group('version')
26- break
27- else:
28- print 'No version number found'
29- sys.exit(1)
30+# if the file it's not there or it doesn't contain the VERSION we
31+# can safely blow up
32+execfile('src/mailman/version.py')
33+__version__ = VERSION
34
35
36