diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-08-30 11:39:46 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-08-30 11:39:46 (GMT) |
commit | fc049089490fd2b7a3693da782eb8ac11a86e26b (patch) | |
tree | 3434b71b444310c3b7bd9c300d64434a67c11973 /BuildTools | |
parent | 749ac4ce99dd67ddff8a553af6569d2dce6e68b4 (diff) | |
download | swift-contrib-fc049089490fd2b7a3693da782eb8ac11a86e26b.zip swift-contrib-fc049089490fd2b7a3693da782eb8ac11a86e26b.tar.bz2 |
Fix build version generator when Git is not present.
The fallback is to return the date as a build version.
Diffstat (limited to 'BuildTools')
-rw-r--r-- | BuildTools/SCons/Version.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/BuildTools/SCons/Version.py b/BuildTools/SCons/Version.py index 94f8510..02edcc9 100644 --- a/BuildTools/SCons/Version.py +++ b/BuildTools/SCons/Version.py @@ -1,10 +1,15 @@ -import subprocess, os +import subprocess, os, datetime def getGitBuildVersion() : - p = subprocess.Popen("git rev-parse HEAD", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, close_fds=(os.name != "nt")) - return p.stdout.read().rstrip()[0:7] + p = subprocess.Popen("git rev-parse HEAD", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=(os.name != "nt")) + gitVersion = p.stdout.read().rstrip()[0:7] + p.stdin.close() + return gitVersion if p.wait() == 0 else None def getBuildVersion(version = None) : if version : return version - return getGitBuildVersion() + gitVersion = getGitBuildVersion() + if gitVersion : + return gitVersion + return datetime.date.today().strftime("%Y%m%d") |