summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-10-05 14:09:42 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-10-05 14:09:42 (GMT)
commit0004ba6b32170b57b3a6a210846aaca9fe80d69b (patch)
treee87e0b24895e1a2c3dabc0db8557c11a73a8d597
parentbb31d6f3a20e8989e182fa78b1bf2edaa2156dea (diff)
downloadswift-contrib-0004ba6b32170b57b3a6a210846aaca9fe80d69b.zip
swift-contrib-0004ba6b32170b57b3a6a210846aaca9fe80d69b.tar.bz2
Pick up version number from file.
-rw-r--r--.gitignore1
-rw-r--r--BuildTools/SCons/Version.py21
2 files changed, 13 insertions, 9 deletions
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")