Skip to content
This repository has been archived by the owner on Oct 2, 2020. It is now read-only.

Seperate LibTable class from check_lib_table functionality #298

Merged
merged 1 commit into from
Feb 23, 2020

Conversation

seppestas
Copy link
Contributor

This makes re-using the LibTable class a bit easier and logical. It also remove schematic lib specific code from LibTable making it re-usable for footprint libraries.

Could be used to e.g check custom options in LibTables. I plan to use it together with the functionality of #297 to only check "approved" symbols in a symbol library by having a CSV "SYMBOLS" field in the library options. This makes something like this possible:

# Check "enabled" symbols of all symbol libraries in a symbol library table for KLC compliance
import subprocess
import re
from importlib import import_module
LibTable = import_module("kicad-library-utils.lib_table").LibTable

lib_table = LibTable('sym_lib_table')

for library in lib_table.entries:
	re_symbols= re.search(r'SYMBOLS=([^ ]+)', library['opt'])
	checklib_args = []
	if re_symbols:
		symbols = re_symbols.groups()[0]
		checklib_args.extend(['-c', symbols])

	checklib_args.append(library['uri'].replace('${KICAD_SYMBOL_DIR}', '../symbols'))
	# TODO: make checklib work as python module
	subprocess.call(['./kicad-library-utils/schlib/checklib.py'] + checklib_args)

This could also be used to add an option to ignore certain rules for a symbol library, see #296.

This makes re-using the LibTable class a bit easier and logical. Could be used
to e.g check custom options in LibTables.

It also remove schematic lib specific code from LibTable making it re-usable
for footprint libraries.
@poeschlr
Copy link
Collaborator

thanks

@poeschlr poeschlr merged commit efba12a into KiCad:master Feb 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants