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 /BuildTools
parentbb31d6f3a20e8989e182fa78b1bf2edaa2156dea (diff)
downloadswift-contrib-0004ba6b32170b57b3a6a210846aaca9fe80d69b.zip
swift-contrib-0004ba6b32170b57b3a6a210846aaca9fe80d69b.tar.bz2
Pick up version number from file.
Diffstat (limited to 'BuildTools')
-rw-r--r--BuildTools/SCons/Version.py21
1 files changed, 12 insertions, 9 deletions
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")