Skip to content

Commit

Permalink
Add svn parse for the full version.
Browse files Browse the repository at this point in the history
  • Loading branch information
cournape committed Mar 27, 2009
1 parent 211c4df commit 9678278
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion setup.py
Expand Up @@ -46,8 +46,18 @@
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.
Expand All @@ -59,6 +69,20 @@
# 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
Expand Down

0 comments on commit 9678278

Please sign in to comment.