From f2faebe9cf6aea833f60da93efcffb7f0c271d82 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Sun, 17 Nov 2013 00:45:11 +0600 Subject: Fix compilation error with SCons when using BUILDINFO and git is not found Fallback to "no buildinfo" mode in this case. --- build_files/scons/tools/Blender.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'build_files/scons/tools') diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index fac81953476..ca3f94a72af 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -410,10 +410,17 @@ def buildinfo(lenv, build_type): """ build_date = time.strftime ("%Y-%m-%d") build_time = time.strftime ("%H:%M:%S") + if os.path.isdir(os.path.abspath('.git')): build_commit_timestamp = os.popen('git log -1 --format=%ct').read().strip() - build_hash = os.popen('git rev-parse --short HEAD').read().strip() - build_branch = os.popen('git rev-parse --abbrev-ref HEAD').read().strip() + if not build_commit_timestamp: + # Git command not found + build_hash = 'unknown' + build_commit_timestamp = '0' + build_branch = 'unknown' + else: + build_hash = os.popen('git rev-parse --short HEAD').read().strip() + build_branch = os.popen('git rev-parse --abbrev-ref HEAD').read().strip() else: build_hash = 'unknown' build_commit_timestamp = '0' -- cgit v1.2.3