Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2014-12-25 17:13:51 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2014-12-25 17:17:30 +0300
commit30e3aa1561ef0b2b1fdebc343b628b6bbf6365c5 (patch)
treef95e9d66159df74cf96c402ad5e1f109a0a8478a /source/blender/datatoc
parentc1f54bcdcca40ef74fac2fa269824f612b4ed8d8 (diff)
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.
Diffstat (limited to 'source/blender/datatoc')
-rwxr-xr-xsource/blender/datatoc/datatoc_icon.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/datatoc/datatoc_icon.py b/source/blender/datatoc/datatoc_icon.py
index 930d588f859..16092431195 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,