From 8218aa8df557060b7f73c572d37dbe78bd31f9c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Tue, 15 Jun 2010 12:43:07 +0200 Subject: Fallback correctly on missing project version tag. 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", "")) -- cgit v0.10.2-6-g49f6