From 5e041cb9ef2547ce40a20cd7e6c20fce64391a4e Mon Sep 17 00:00:00 2001 From: David Cournapeau Date: Fri, 27 Mar 2009 11:16:01 +0000 Subject: Add svn parse for the full version. --- setup.py | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 9ced0869f..ba4e7a41d 100755 --- a/setup.py +++ b/setup.py @@ -46,8 +46,18 @@ CLASSIFIERS = filter(None, CLASSIFIERS.split('\n')), AUTHOR = "Travis E. Oliphant, et.al.", AUTHOR_EMAIL = "oliphant@enthought.com", PLATFORMS = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"], -VERSION = '1.4.0' +MAJOR = 1 +MINOR = 4 +MICRO = 0 ISRELEASED = False +VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) + +FULLVERSION = VERSION +if not ISRELEASED: + FULLVERSION += '.dev' + # If in git or something, bypass the svn rev + if os.path.exists('.svn.'): + FULLVERSION += svn_version() # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly # update it when the contents of directories change. @@ -59,6 +69,20 @@ if os.path.exists('MANIFEST'): os.remove('MANIFEST') # a lot more robust than what was previously being used. __builtin__.__NUMPY_SETUP__ = True +# Return the svn version as a string, raise a ValueError otherwise +def svn_version(): + out = subprocess.Popen(['svn', 'info'], stdout = subprocess.PIPE).communicate()[0] + r = re.compile('Revision: ([0-9]+)') + svnver = None + for line in out.split('\n'): + m = r.match(line) + if m: + svnver = m.group(1) + + if not svnver: + raise ValueError("Error while parsing svn version ?") + return svnver + def write_version_py(filename='numpy/version.py'): cnt = """ # THIS FILE IS GENERATED FROM NUMPY SETUP.PY -- cgit v1.2.1