Fixed $cwd and $target not defined during silent run.

This commit is contained in:
Chris Palmer 2021-02-08 15:00:01 +00:00
parent cfd2fd32a1
commit 1c3f136657
1 changed files with 3 additions and 3 deletions

View File

@ -65,6 +65,8 @@ def plateup(target, part_type, usage = None):
# #
# Run OpenSCAD on the source files to make the targets # Run OpenSCAD on the source files to make the targets
# #
target_def = ['-D$target="%s"' % target] if target else []
cwd_def = ['-D$cwd="%s"' % os.getcwd().replace('\\', '/')]
for src in sources: for src in sources:
src_file = dir + '/' + src src_file = dir + '/' + src
part_file = target_dir + '/' + src[:-4] + part_type part_file = target_dir + '/' + src[:-4] + part_type
@ -72,15 +74,13 @@ def plateup(target, part_type, usage = None):
changed = check_deps(part_file, dname) changed = check_deps(part_file, dname)
if changed: if changed:
print(changed) print(changed)
target_def = ['-D$target="%s"' % target] if target else []
cwd_def = ['-D$cwd="%s"' % os.getcwd().replace('\\', '/')]
openscad.run_list(["-D$bom=1"] + target_def + cwd_def + ["-d", dname, "-o", part_file, src_file]) openscad.run_list(["-D$bom=1"] + target_def + cwd_def + ["-d", dname, "-o", part_file, src_file])
if part_type == 'stl': if part_type == 'stl':
c14n_stl.canonicalise(part_file) c14n_stl.canonicalise(part_file)
log_name = 'openscad.log' log_name = 'openscad.log'
else: else:
log_name = 'openscad.echo' log_name = 'openscad.echo'
openscad.run_silent("-D$bom=1", "-o", log_name, src_file) openscad.run_list(["-D$bom=1"] + target_def + cwd_def + ["-o", log_name, src_file], silent = True)
# #
# Add the files on the BOM to the used list # Add the files on the BOM to the used list
# #