diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-05-29 18:05:28 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-05-29 18:05:51 (GMT) |
commit | 8850545f853d0b30212b37be6be0f1e47704122d (patch) | |
tree | 2cf5f1cc89817ec9ef4ab23790c5939986e77eb7 /BuildTools | |
parent | bd7cc758641bec5b3cf9fc47a9c2b48082f943da (diff) | |
download | swift-8850545f853d0b30212b37be6be0f1e47704122d.zip swift-8850545f853d0b30212b37be6be0f1e47704122d.tar.bz2 |
Simplify Git build version detection.
Diffstat (limited to 'BuildTools')
-rw-r--r-- | BuildTools/SCons/Version.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/BuildTools/SCons/Version.py b/BuildTools/SCons/Version.py index 0ff1531..401df21 100644 --- a/BuildTools/SCons/Version.py +++ b/BuildTools/SCons/Version.py @@ -1,16 +1,10 @@ import subprocess, os, datetime def getGitBuildVersion(project) : - headVersion = git("rev-parse HEAD") - if headVersion : - tags = git("tag --contains HEAD -l " + project + "-*") - if len(tags) > 0 : - for tag in tags.split("\n") : - tagVersion = git("rev-parse " + tag + "^{commit}") - if tagVersion == headVersion : - return tag[len(project)+1:] - return None - + tag = git("describe --tags --exact --match " + project + "-*") + if tag : + return tag.rstrip()[len(project)+1:] + def git(cmd) : p = subprocess.Popen("git " + cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(os.name != "nt")) gitVersion = p.stdout.read() |