diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-06-15 10:43:07 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-06-15 10:43:07 (GMT) |
commit | 8218aa8df557060b7f73c572d37dbe78bd31f9c0 (patch) | |
tree | fe1e4fce2c61d6f2ce6c623644ade388a3b10f9c /BuildTools/SCons | |
parent | c652a2651d5ed7b6002fd9e63cd25f1d58224ed3 (diff) | |
download | swift-contrib-8218aa8df557060b7f73c572d37dbe78bd31f9c0.zip swift-contrib-8218aa8df557060b7f73c572d37dbe78bd31f9c0.tar.bz2 |
Fallback correctly on missing project version tag.
Diffstat (limited to 'BuildTools/SCons')
-rw-r--r-- | BuildTools/SCons/Version.py | 12 |
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")) |