[Bf-blender-cvs] [9b83ceb] master: Fix scons building in case git is not available.

Bastien Montagne noreply at git.blender.org
Fri Jun 20 18:19:13 CEST 2014


Commit: 9b83ceb6f2865f77aca0c0bdcce4e1b6c5cdef8b
Author: Bastien Montagne
Date:   Fri Jun 20 18:13:20 2014 +0200
https://developer.blender.org/rB9b83ceb6f2865f77aca0c0bdcce4e1b6c5cdef8b

Fix scons building in case git is not available.

Not so nice to use try/except here, but simplest solution to avoid failing in case
git commands fail for some reason...

===================================================================

M	build_files/scons/tools/Blender.py
M	build_files/scons/tools/btools.py

===================================================================

diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py
index a506d2c..4d9fb57 100644
--- a/build_files/scons/tools/Blender.py
+++ b/build_files/scons/tools/Blender.py
@@ -412,7 +412,10 @@ def buildinfo(lenv, build_type):
     build_time = time.strftime ("%H:%M:%S")
 
     if os.path.isdir(os.path.abspath('.git')):
-        build_commit_timestamp = subprocess.check_output(args=['git', 'log', '-1', '--format=%ct']).strip()
+        try:
+            build_commit_timestamp = subprocess.check_output(args=['git', 'log', '-1', '--format=%ct']).strip()
+        except:
+            build_commit_timestamp = None
         if not build_commit_timestamp:
             # Git command not found
             build_hash = 'unknown'
diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py
index 08a3eec..bdbb016 100644
--- a/build_files/scons/tools/btools.py
+++ b/build_files/scons/tools/btools.py
@@ -56,7 +56,11 @@ def get_version():
     raise Exception("%s: missing version string" % fname)
 
 def get_hash():
-    build_hash = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).strip()
+    try:
+        build_hash = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).strip()
+    except:
+        build_hash = None
+        print("WARNING: could not use git to retrieve current Blender repository hash...")
     if build_hash == '' or build_hash == None:
         build_hash = 'UNKNOWN'




More information about the Bf-blender-cvs mailing list