summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-06-15 10:43:07 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-06-15 10:43:07 (GMT)
commit8218aa8df557060b7f73c572d37dbe78bd31f9c0 (patch)
treefe1e4fce2c61d6f2ce6c623644ade388a3b10f9c
parentc652a2651d5ed7b6002fd9e63cd25f1d58224ed3 (diff)
downloadswift-8218aa8df557060b7f73c572d37dbe78bd31f9c0.zip
swift-8218aa8df557060b7f73c572d37dbe78bd31f9c0.tar.bz2
Fallback correctly on missing project version tag.
-rw-r--r--BuildTools/SCons/Version.py12
-rw-r--r--Limber/SConscript1
2 files changed, 10 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"))
diff --git a/Limber/SConscript b/Limber/SConscript
index e766f97..c81f1f8 100644
--- a/Limber/SConscript
+++ b/Limber/SConscript
@@ -2,6 +2,7 @@ Import("env")
if env["SCONS_STAGE"] == "build" :
myenv = env.Clone()
+ myenv.BuildVersion("BuildVersion.h", project = "limber")
myenv.MergeFlags(env["SWIFTEN_FLAGS"])
myenv.MergeFlags(env["LIBIDN_FLAGS"])
myenv.MergeFlags(env.get("LIBXML_FLAGS", ""))