summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'BuildTools/SCons/Version.py')
-rw-r--r--BuildTools/SCons/Version.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/BuildTools/SCons/Version.py b/BuildTools/SCons/Version.py
index 9c690e5..091d998 100644
--- a/BuildTools/SCons/Version.py
+++ b/BuildTools/SCons/Version.py
@@ -5,9 +5,15 @@ def getGitBuildVersion(project) :
if tag :
return tag.rstrip()[len(project)+1:]
tag = git("describe --tags --match \"" + project + "-*\"")
- m = re.match(project + "-(.*)-(.*)-(.*)", tag)
- if m :
- return m.group(1) + "-dev" + m.group(2)
+ if tag :
+ m = re.match(project + "-(.*)-(.*)-(.*)", tag)
+ if m :
+ return m.group(1) + "-dev" + m.group(2)
+ log = git("log --oneline")
+ if log :
+ return project + "-0.1-dev" + str(len(log.split("\n")))
+ else :
+ return project + "-0.0-dev"
def git(cmd) :
p = subprocess.Popen("git " + cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(os.name != "nt"))