diff options
Diffstat (limited to 'BuildTools/SCons')
-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") |