From 30e3aa1561ef0b2b1fdebc343b628b6bbf6365c5 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 25 Dec 2014 19:13:51 +0500 Subject: 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. --- source/blender/datatoc/datatoc_icon.py | 11 +++++++++++ 1 file changed, 11 insertions(+) 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, -- cgit v1.2.3