changeset 179:acc718ab56da 2.0.0a5

setup: Make version generation compatible with PEP440.
author Ludovic Chabant <ludovic@chabant.com>
date Sat, 03 Jan 2015 23:13:06 -0800
parents ff5b2d3863a8
children ede1a59f481d
files setup.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/setup.py	Sat Jan 03 22:07:35 2015 -0800
+++ b/setup.py	Sat Jan 03 23:13:06 2015 -0800
@@ -63,6 +63,7 @@
         raise Exception("Can't generate version number: this is not a "
                         "Mercurial repository.")
 
+
 def generate_version_from_mercurial():
     try:
         # Get the version we're currently on. Also see if we have local
@@ -93,10 +94,14 @@
                 # Let's just do as if we were on the tag.
                 version = tag
             else:
-                version = '%s-%s-%s' % (tag, dist, hgid)
+                version = '%s+%s.%s' % (tag, dist, hgid)
 
         if has_local_changes:
-            version += time.strftime('+%Y%m%d')
+            if '+' in version:
+                version += '.'
+            else:
+                version += '+'
+            version += time.strftime('%Y%m%d')
 
         return version
     except OSError: