From fc049089490fd2b7a3693da782eb8ac11a86e26b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Sun, 30 Aug 2009 13:39:46 +0200 Subject: Fix build version generator when Git is not present. The fallback is to return the date as a build version. 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") -- cgit v0.10.2-6-g49f6