make_all.py now terminates early if there are any errors in bom generation.

This commit is contained in:
Chris Palmer 2020-04-29 15:19:10 +01:00
parent cedaafed3d
commit 828e5ad36e

View File

@ -213,7 +213,7 @@ def parse_bom(file = "openscad.log", name = None):
main.assemblies[stack[-1]].add_part(s) main.assemblies[stack[-1]].add_part(s)
else: else:
if 'ERROR:' in line or 'WARNING:' in line: if 'ERROR:' in line or 'WARNING:' in line:
print(line[:-1]) raise Exception(line[:-1])
return main return main
def usage(): def usage():
@ -221,6 +221,7 @@ def usage():
sys.exit(1) sys.exit(1)
def boms(target = None, assembly = None): def boms(target = None, assembly = None):
try:
bom_dir = set_config(target, usage) + "bom" bom_dir = set_config(target, usage) + "bom"
if assembly: if assembly:
bom_dir += "/accessories" bom_dir += "/accessories"
@ -268,6 +269,9 @@ def boms(target = None, assembly = None):
json.dump(data, outfile, indent = 4) json.dump(data, outfile, indent = 4)
print("done") print("done")
except Exception as e:
print(str(e))
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':
if len(sys.argv) > 3: usage() if len(sys.argv) > 3: usage()
@ -286,8 +290,4 @@ if __name__ == '__main__':
if assembly: if assembly:
if assembly[-9:] != "_assembly": usage() if assembly[-9:] != "_assembly": usage()
try:
boms(target, assembly) boms(target, assembly)
except Exception as e:
print(str(e))
sys.exit(1)