Fixed `gerber` example generation when no SCH

- We must skip anything using variants
- We must fix the compress sources
This commit is contained in:
Salvador E. Tropea 2022-04-28 14:08:25 -03:00
parent ae380726b2
commit 5881f2b6c4
1 changed files with 10 additions and 1 deletions

View File

@ -122,6 +122,7 @@ class Gerber(AnyLayer):
useful = GS.get_useful_layers(USEFUL_LAYERS, layers, include_copper=True)
tpl_layers = [AnyLayer.layer2dict(la) for la in useful]
# Add the list of layers to the templates
skipped = []
for tpl in templates:
for out in tpl:
skip = False
@ -129,13 +130,21 @@ class Gerber(AnyLayer):
out['layers'] = tpl_layers
elif out['type'] == 'position':
out['options']['variant'] = 'place_holder'
if not GS.sch:
# We need the schematic for the variant
skip = True
if out['type'] == 'bom' and not GS.sch_file:
skip = True
if out['type'] == 'compress':
out['dir'] = 'Manufacturers'
out['options']['move_files'] = True
if skipped:
# Compress only the ones we didn't skip
out['options']['files'] = [f for f in out['options']['files'] if f['from_output'] not in skipped]
else:
out['dir'] = os.path.join('Manufacturers', out['dir'])
if not skip:
if skip:
skipped.append(out['name'])
else:
outs.append(out)
return outs