mirror of
https://github.com/nophead/NopSCADlib.git
synced 2025-08-06 07:27:23 +02:00
Missing targets now named when dependency checking.
This commit is contained in:
@@ -37,9 +37,10 @@ def read_deps(dname):
|
|||||||
deps.append(dep)
|
deps.append(dep)
|
||||||
return deps
|
return deps
|
||||||
|
|
||||||
def check_deps(target_mtime, dname):
|
def check_deps(target, dname):
|
||||||
|
target_mtime = mtime(target)
|
||||||
if not target_mtime:
|
if not target_mtime:
|
||||||
return "target missing"
|
return target + " missing"
|
||||||
if not os.path.isfile(dname):
|
if not os.path.isfile(dname):
|
||||||
return "no deps"
|
return "no deps"
|
||||||
deps = read_deps(dname)
|
deps = read_deps(dname)
|
||||||
|
@@ -84,7 +84,6 @@ def make_parts(target, part_type, parts = None):
|
|||||||
# Find all the scad files
|
# Find all the scad files
|
||||||
#
|
#
|
||||||
lib_dir = os.environ['OPENSCADPATH'] + '/NopSCADlib/printed'
|
lib_dir = os.environ['OPENSCADPATH'] + '/NopSCADlib/printed'
|
||||||
used = []
|
|
||||||
module_suffix = '_dxf' if part_type == 'svg' else '_' + part_type
|
module_suffix = '_dxf' if part_type == 'svg' else '_' + part_type
|
||||||
for dir in [source_dir, lib_dir]:
|
for dir in [source_dir, lib_dir]:
|
||||||
for filename in os.listdir(dir):
|
for filename in os.listdir(dir):
|
||||||
@@ -113,7 +112,7 @@ def make_parts(target, part_type, parts = None):
|
|||||||
#
|
#
|
||||||
part_file = target_dir + "/" + part
|
part_file = target_dir + "/" + part
|
||||||
dname = deps_name(deps_dir, filename)
|
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)
|
changed = times.check_have_time(changed, part)
|
||||||
if part_type == 'stl' and not changed and not part in bounds_map:
|
if part_type == 'stl' and not changed and not part in bounds_map:
|
||||||
changed = "No bounds"
|
changed = "No bounds"
|
||||||
@@ -125,14 +124,9 @@ def make_parts(target, part_type, parts = None):
|
|||||||
if part_type == 'stl':
|
if part_type == 'stl':
|
||||||
bounds = c14n_stl.canonicalise(part_file)
|
bounds = c14n_stl.canonicalise(part_file)
|
||||||
bounds_map[part] = bounds
|
bounds_map[part] = bounds
|
||||||
|
|
||||||
targets.remove(part)
|
targets.remove(part)
|
||||||
os.remove(part_maker_name)
|
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
|
# 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)
|
print("Could not find a module called", part[:-4] + module_suffix, "to make", part)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
times.print_times()
|
times.print_times()
|
||||||
return used
|
|
||||||
|
@@ -187,7 +187,7 @@ def tests(tests):
|
|||||||
body += ["\n" %(base_name, png_name)]
|
body += ["\n" %(base_name, png_name)]
|
||||||
|
|
||||||
dname = deps_name(deps_dir, scad)
|
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 = check_deps(oldest, dname)
|
||||||
changed = times.check_have_time(changed, scad_name)
|
changed = times.check_have_time(changed, scad_name)
|
||||||
if changed:
|
if changed:
|
||||||
|
@@ -154,14 +154,14 @@ def views(target, do_assemblies = None):
|
|||||||
f.write("use <%s/%s>\n" % (dir, filename))
|
f.write("use <%s/%s>\n" % (dir, filename))
|
||||||
f.write("%s();\n" % module);
|
f.write("%s();\n" % module);
|
||||||
#
|
#
|
||||||
# Run openscad on the created file
|
# Run openscad on th created file
|
||||||
#
|
#
|
||||||
dname = deps_name(deps_dir, filename)
|
dname = deps_name(deps_dir, filename)
|
||||||
for explode in [0, 1]:
|
for explode in [0, 1]:
|
||||||
png_name = target_dir + '/' + module + '.png'
|
png_name = target_dir + '/' + module + '.png'
|
||||||
if not explode:
|
if not explode:
|
||||||
png_name = png_name.replace('_assembly', '_assembled')
|
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)
|
changed = times.check_have_time(changed, png_name)
|
||||||
tmp_name = 'tmp.png'
|
tmp_name = 'tmp.png'
|
||||||
if changed:
|
if changed:
|
||||||
|
Reference in New Issue
Block a user