From 0004ba6b32170b57b3a6a210846aaca9fe80d69b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Tue, 5 Oct 2010 16:09:42 +0200 Subject: Pick up version number from file. diff --git a/.gitignore b/.gitignore index f2141b5..aea15e9 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ Swiften/Examples/TuneBot/TuneBot Swift/QtUI/swift Swift/QtUI/DefaultTheme.qrc checker-report.xml +VERSION.* diff --git a/BuildTools/SCons/Version.py b/BuildTools/SCons/Version.py index 091d998..4a2bf77 100644 --- a/BuildTools/SCons/Version.py +++ b/BuildTools/SCons/Version.py @@ -1,4 +1,4 @@ -import subprocess, os, datetime, re +import subprocess, os, datetime, re, os.path def getGitBuildVersion(project) : tag = git("describe --tags --exact --match \"" + project + "-*\"") @@ -9,11 +9,7 @@ def getGitBuildVersion(project) : 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" + return None def git(cmd) : p = subprocess.Popen("git " + cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(os.name != "nt")) @@ -25,6 +21,13 @@ def getBuildVersion(project) : gitVersion = getGitBuildVersion(project) if gitVersion : return gitVersion - # TODO: Add the current branch - # TODO: Pick up a version number from a file (for distributing) - return datetime.date.today().strftime("%Y%m%d") + else : + versionFilename = "VERSION." + project + if os.path.isfile(versionFilename) : + f = open(versionFilename) + version = f.read().strip() + f.close() + return version + else : + # TODO: Add the current branch + return datetime.date.today().strftime("%Y%m%d") -- cgit v0.10.2-6-g49f6