[Bf-blender-cvs] [30e3aa1] master: SCons: Don't regenerate icons if not changes

Sergey Sharybin noreply at git.blender.org
Thu Dec 25 15:17:45 CET 2014


Commit: 30e3aa1561ef0b2b1fdebc343b628b6bbf6365c5
Author: Sergey Sharybin
Date:   Thu Dec 25 19:13:51 2014 +0500
Branches: master
https://developer.blender.org/rB30e3aa1561ef0b2b1fdebc343b628b6bbf6365c5

SCons: Don't regenerate icons if not changes

This is rather a handbook example how NOT to do things in SCons, ideally
it should be official SCons target so all the dependencies and source file
modification stops being our worry. Especially since for CMake we already
do have an app to do generate all the data.

I don't have time to clean this up now but this constant icons regeneration
just pisses me off atm.

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

M	source/blender/datatoc/datatoc_icon.py

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

diff --git a/source/blender/datatoc/datatoc_icon.py b/source/blender/datatoc/datatoc_icon.py
index 930d588..1609243 100755
--- a/source/blender/datatoc/datatoc_icon.py
+++ b/source/blender/datatoc/datatoc_icon.py
@@ -113,6 +113,17 @@ def icondir_to_png(path_src, file_dst):
 
     files = [os.path.join(path_src, f) for f in os.listdir(path_src) if f.endswith(".dat")]
 
+    # First check if we need to bother.
+    if os.path.exists(file_dst):
+        dst_time = os.path.getmtime(file_dst)
+        has_newer = False
+        for f in files:
+            if os.path.getmtime(f) > dst_time:
+                has_newer = True
+                break
+        if not has_newer:
+            return
+
     with open(files[0], 'rb') as f_src:
         (icon_w, icon_h,
          orig_x, orig_y,




More information about the Bf-blender-cvs mailing list