diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-11-16 22:45:11 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-11-16 22:45:46 +0400 |
commit | f2faebe9cf6aea833f60da93efcffb7f0c271d82 (patch) | |
tree | 8903e334fcb9d34824e07cf9063f9e0b21c3e75b /build_files | |
parent | 8bc48307bac9755b68297ebc2a6565a4b2343400 (diff) |
Fix compilation error with SCons when using BUILDINFO and git is not found
Fallback to "no buildinfo" mode in this case.
Diffstat (limited to 'build_files')
-rw-r--r-- | build_files/scons/tools/Blender.py | 11 |
1 files changed, 9 insertions, 2 deletions
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' |