Fix packaging on non-releases.
authorCarl Hetherington <cth@carlh.net>
Wed, 28 Nov 2018 21:21:31 +0000 (21:21 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 28 Nov 2018 21:21:31 +0000 (21:21 +0000)
cdist

diff --git a/cdist b/cdist
index 7c8098cfcc40c893d619a43ee885fd239db27353..1e71b46ab2fa59070a275498bd0ff9496806d1ae 100755 (executable)
--- a/cdist
+++ b/cdist
@@ -260,7 +260,6 @@ def set_version_in_wscript(version):
 
         s = l.split()
         if len(s) == 3 and s[0] == "VERSION":
-            print("Writing %s" % version)
             print("VERSION = '%s'" % version, file=o)
         else:
             print(l, file=o, end="")
@@ -349,6 +348,14 @@ class Version:
         else:
             self.micro = 0
 
+    @classmethod
+    def from_git_tag(cls, tag):
+        bits = tag.split('-')
+        c = cls(bits[0])
+        if int(bits[1]) > 0:
+            c.devel = True
+        return c
+
     def bump_minor(self):
         self.minor += 1
         self.micro = 0
@@ -870,7 +877,8 @@ class Tree(object):
                 try:
                     self.version = Version(v)
                 except:
-                    self.version = Version(subprocess.Popen(shlex.split('git -C %s describe --tags --abbrev=0' % proj), stdout=subprocess.PIPE).communicate()[0][1:])
+                    tag = subprocess.Popen(shlex.split('git -C %s describe --tags' % proj), stdout=subprocess.PIPE).communicate()[0][1:]
+                    self.version = Version.from_git_tag(tag)
 
         os.chdir(cwd)