diff options
author | David Cournapeau <cournape@gmail.com> | 2009-03-27 11:16:01 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2009-03-27 11:16:01 +0000 |
commit | 5e041cb9ef2547ce40a20cd7e6c20fce64391a4e (patch) | |
tree | 455c97c074c92991c516af6ddcd7defe90af98b9 /setup.py | |
parent | 914bb15da83d0217f8162fbc2c599ec3f7e36b77 (diff) | |
download | numpy-5e041cb9ef2547ce40a20cd7e6c20fce64391a4e.tar.gz |
Add svn parse for the full version.
Diffstat (limited to 'setup.py')
-rwxr-xr-x | setup.py | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -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 |