Skip to content

Commit df09af5

Browse files
committed
Revert "[E/DRC][KiCad 10] Try harder to get the lib tables"
This reverts commit 3521348. As the tables are now in the image and this is making 3D targets to fail
1 parent 3521348 commit df09af5

2 files changed

Lines changed: 15 additions & 20 deletions

File tree

kibot/kicad/config.py

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -565,36 +565,31 @@ def get_fp_lib_aliases(fname=None):
565565
KiConf.fp_aliases = KiConf.load_all_lib_aliases(FP_LIB_TABLE, KiConf.footprint_dir, '*.pretty')
566566
return KiConf.fp_aliases
567567

568-
def check_fp_lib_table(fname=None, force=False):
568+
def check_fp_lib_table(fname=None):
569569
if fname is None:
570570
fname = GS.pcb_file
571-
KiConf.check_lib_table(fname, FP_LIB_TABLE, force)
571+
KiConf.check_lib_table(fname, FP_LIB_TABLE)
572572

573-
def check_sym_lib_table(fname=None, force=False):
573+
def check_sym_lib_table(fname=None):
574574
if fname is None:
575575
fname = GS.sch_file
576-
KiConf.check_lib_table(fname, SYM_LIB_TABLE, force)
576+
KiConf.check_lib_table(fname, SYM_LIB_TABLE)
577577

578-
def check_lib_table(fname, table_name, force):
578+
def check_lib_table(fname, table_name):
579579
KiConf.init(fname)
580-
if KiConf.config_dir is None and GS.kicad_conf_path and force:
581-
# In force mode we try harder to get the table
582-
# If we don't have a KiCad config file at least create the config dir
583-
os.makedirs(GS.kicad_conf_path, exist_ok=True)
584-
KiConf.config_dir = GS.kicad_conf_path
585580
if KiConf.config_dir:
586-
if not os.path.isfile(os.path.join(KiConf.config_dir, table_name)):
587-
# No global lib table
588-
global_table_name = os.path.join(KiConf.template_dir, table_name) if KiConf.template_dir else None
589-
if global_table_name and os.path.isfile(global_table_name):
581+
fp_name = os.path.join(KiConf.config_dir, table_name)
582+
if not os.path.isfile(fp_name):
583+
# No global fp lib table
584+
global_fp_name = os.path.join(KiConf.template_dir, table_name) if KiConf.template_dir else None
585+
if global_fp_name and os.path.isfile(global_fp_name):
590586
# Try to copy the template
591587
if not GS.ci_cd_detected:
592588
logger.warning(f'{W_MISLIBTAB}Missing default system footprint table {table_name},'
593589
' copying the template')
594-
table_name = os.path.join(os.path.dirname(fname), table_name)
595-
logger.debug(f'Copying {global_table_name} to {table_name}')
596-
copy2(global_table_name, table_name)
597-
atexit.register(KiConf.remove_lib_table, table_name)
590+
logger.debug(f'Copying {global_fp_name} to {fp_name}')
591+
copy2(global_fp_name, fp_name)
592+
atexit.register(KiConf.remove_lib_table, fp_name)
598593

599594
def remove_lib_table(fname):
600595
if os.path.isfile(fname):

kibot/pre_any_xrc.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,9 @@ def run(self):
314314
# Differences between ERC and DRC
315315
if GS.sch_file:
316316
# May be needed by DRC when checking parity?
317-
KiConf.check_sym_lib_table(force=GS.ki10)
317+
KiConf.check_sym_lib_table()
318318
if GS.pcb_file:
319-
KiConf.check_fp_lib_table(force=GS.ki10)
319+
KiConf.check_fp_lib_table()
320320
if self._sch_related:
321321
nm = 'ERC'
322322
err = ERC_ERROR

0 commit comments

Comments
 (0)