From be324c31dacbcc06f922a9821825159f3b347094 Mon Sep 17 00:00:00 2001 From: Chris Palmer Date: Sun, 18 Aug 2019 10:53:22 +0100 Subject: [PATCH] Missing targets now named when dependency checking. --- scripts/deps.py | 5 +++-- scripts/exports.py | 11 ++--------- scripts/tests.py | 2 +- scripts/views.py | 4 ++-- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/scripts/deps.py b/scripts/deps.py index d383a3f..599d665 100644 --- a/scripts/deps.py +++ b/scripts/deps.py @@ -37,9 +37,10 @@ def read_deps(dname): deps.append(dep) return deps -def check_deps(target_mtime, dname): +def check_deps(target, dname): + target_mtime = mtime(target) if not target_mtime: - return "target missing" + return target + " missing" if not os.path.isfile(dname): return "no deps" deps = read_deps(dname) diff --git a/scripts/exports.py b/scripts/exports.py index 953674d..384a8f6 100644 --- a/scripts/exports.py +++ b/scripts/exports.py @@ -84,7 +84,6 @@ def make_parts(target, part_type, parts = None): # Find all the scad files # lib_dir = os.environ['OPENSCADPATH'] + '/NopSCADlib/printed' - used = [] module_suffix = '_dxf' if part_type == 'svg' else '_' + part_type for dir in [source_dir, lib_dir]: for filename in os.listdir(dir): @@ -113,7 +112,7 @@ def make_parts(target, part_type, parts = None): # part_file = target_dir + "/" + part dname = deps_name(deps_dir, filename) - changed = check_deps(mtime(part_file), dname) + changed = check_deps(part_file, dname) changed = times.check_have_time(changed, part) if part_type == 'stl' and not changed and not part in bounds_map: changed = "No bounds" @@ -125,14 +124,9 @@ def make_parts(target, part_type, parts = None): if part_type == 'stl': bounds = c14n_stl.canonicalise(part_file) bounds_map[part] = bounds + targets.remove(part) os.remove(part_maker_name) - # - # Add the files on the BOM to the used list for plates.py - # - for line in open("openscad.log"): - if line[:7] == 'ECHO: "' and line[-6:] == '.' + part_type + '"\n': - used.append(line[7:-2]) # # Write new bounds file # @@ -150,4 +144,3 @@ def make_parts(target, part_type, parts = None): print("Could not find a module called", part[:-4] + module_suffix, "to make", part) sys.exit(1) times.print_times() - return used diff --git a/scripts/tests.py b/scripts/tests.py index 784e77b..403007b 100644 --- a/scripts/tests.py +++ b/scripts/tests.py @@ -187,7 +187,7 @@ def tests(tests): body += ["![%s](%s)\n" %(base_name, png_name)] dname = deps_name(deps_dir, scad) - oldest = min(mtime(png_name), mtime(bom_name)) + oldest = png_name if mtime(png_name) < mtime(bom_name) else bom_name changed = check_deps(oldest, dname) changed = times.check_have_time(changed, scad_name) if changed: diff --git a/scripts/views.py b/scripts/views.py index efac634..ab2d8c7 100644 --- a/scripts/views.py +++ b/scripts/views.py @@ -154,14 +154,14 @@ def views(target, do_assemblies = None): f.write("use <%s/%s>\n" % (dir, filename)) f.write("%s();\n" % module); # - # Run openscad on the created file + # Run openscad on th created file # dname = deps_name(deps_dir, filename) for explode in [0, 1]: png_name = target_dir + '/' + module + '.png' if not explode: png_name = png_name.replace('_assembly', '_assembled') - changed = check_deps(mtime(png_name), dname) + changed = check_deps(png_name, dname) changed = times.check_have_time(changed, png_name) tmp_name = 'tmp.png' if changed: