KiCad v6: test_gerber.py adpted to the new layer names

This commit is contained in:
Diego Capusotto 2021-12-17 12:45:44 -03:00
parent e733ce1289
commit 14e0a90dce
1 changed files with 17 additions and 1 deletions

View File

@ -15,7 +15,17 @@ if prev_dir not in sys.path:
sys.path.insert(0, prev_dir)
# Utils import
from utils import context
from kibot.misc import (PLOT_ERROR)
from kibot.misc import PLOT_ERROR
from kibot.layer import Layer
from kibot.gs import GS
from kibot.__main__ import detect_kicad
def ki5_2_ki6(l):
l_dot = l.replace('_', '.')
if l_dot in Layer.KICAD6_RENAME:
l = Layer.KICAD6_RENAME[l_dot].replace('.', '_')
return l
GERBER_DIR = 'gerberdir'
@ -40,6 +50,10 @@ ALL_LAYERS = ['B_Adhes',
'F_SilkS',
'Margin',
]
detect_kicad()
# New layer names in KiCad 6
if GS.ki6():
ALL_LAYERS = [ki5_2_ki6(l) for l in ALL_LAYERS]
ALL_EXTS = ['gba',
'gbr',
'gbl',
@ -126,6 +140,8 @@ def check_layers_exist(ctx, dir, prefix, layers, suffix):
def check_components(ctx, dir, prefix, layers, suffix, exclude, include):
if GS.ki6():
layers = [ki5_2_ki6(l) for l in layers]
for layer in layers:
fname = compose_fname(dir, prefix, layer, suffix)
inc = [r'%TO\.C,{}\*%'.format(v) for v in include]