Added support for iBoM installed as plugin
- Not yet functional, we are working on iBoM layout See: openscopeproject/InteractiveHtmlBom#301
This commit is contained in:
parent
8ae9dff143
commit
0a3dff85f2
|
|
@ -213,6 +213,7 @@ def detect_kicad():
|
||||||
# /usr/share/kicad/*
|
# /usr/share/kicad/*
|
||||||
GS.kicad_plugins_dirs.append(os.path.join(GS.kicad_share_path, 'scripting'))
|
GS.kicad_plugins_dirs.append(os.path.join(GS.kicad_share_path, 'scripting'))
|
||||||
GS.kicad_plugins_dirs.append(os.path.join(GS.kicad_share_path, 'scripting', 'plugins'))
|
GS.kicad_plugins_dirs.append(os.path.join(GS.kicad_share_path, 'scripting', 'plugins'))
|
||||||
|
GS.kicad_plugins_dirs.append(os.path.join(GS.kicad_share_path, '3rdparty', 'plugins')) # KiCad 6.0 PCM
|
||||||
# ~/.config/kicad/*
|
# ~/.config/kicad/*
|
||||||
GS.kicad_plugins_dirs.append(os.path.join(GS.kicad_conf_path, 'scripting'))
|
GS.kicad_plugins_dirs.append(os.path.join(GS.kicad_conf_path, 'scripting'))
|
||||||
GS.kicad_plugins_dirs.append(os.path.join(GS.kicad_conf_path, 'scripting', 'plugins'))
|
GS.kicad_plugins_dirs.append(os.path.join(GS.kicad_conf_path, 'scripting', 'plugins'))
|
||||||
|
|
@ -222,6 +223,10 @@ def detect_kicad():
|
||||||
GS.kicad_plugins_dirs.append(os.path.join(home, '.kicad_plugins'))
|
GS.kicad_plugins_dirs.append(os.path.join(home, '.kicad_plugins'))
|
||||||
GS.kicad_plugins_dirs.append(os.path.join(home, '.kicad', 'scripting'))
|
GS.kicad_plugins_dirs.append(os.path.join(home, '.kicad', 'scripting'))
|
||||||
GS.kicad_plugins_dirs.append(os.path.join(home, '.kicad', 'scripting', 'plugins'))
|
GS.kicad_plugins_dirs.append(os.path.join(home, '.kicad', 'scripting', 'plugins'))
|
||||||
|
if GS.kicad_version_major >= 6:
|
||||||
|
# KiCad 6.0 PCM
|
||||||
|
ver_dir = str(GS.kicad_version_major)+'.'+str(GS.kicad_version_minor)
|
||||||
|
GS.kicad_plugins_dirs.append(os.path.join(home, '.local', 'share', 'kicad', ver_dir, '3rdparty', 'plugins'))
|
||||||
if GS.debug_level > 1:
|
if GS.debug_level > 1:
|
||||||
logger.debug('KiCad config path {}'.format(GS.kicad_conf_path))
|
logger.debug('KiCad config path {}'.format(GS.kicad_conf_path))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,8 @@ def check_version(command, version):
|
||||||
if command in script_versions:
|
if command in script_versions:
|
||||||
return
|
return
|
||||||
cmd = [command, '--version']
|
cmd = [command, '--version']
|
||||||
|
if not os.access(command, os.X_OK) and command.endswith('.py'):
|
||||||
|
cmd.insert(0, 'python3')
|
||||||
logger.debug('Running: '+str(cmd))
|
logger.debug('Running: '+str(cmd))
|
||||||
result = run(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True)
|
result = run(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True)
|
||||||
z = re.match(command + r' (\d+\.\d+\.\d+)', result.stdout, re.IGNORECASE)
|
z = re.match(command + r' (\d+\.\d+\.\d+)', result.stdout, re.IGNORECASE)
|
||||||
|
|
@ -120,7 +122,7 @@ def check_version(command, version):
|
||||||
|
|
||||||
|
|
||||||
def check_script(cmd, url, version=None):
|
def check_script(cmd, url, version=None):
|
||||||
if which(cmd) is None:
|
if which(cmd) is None and not os.path.isfile(cmd):
|
||||||
logger.error('No `'+cmd+'` command found.\n'
|
logger.error('No `'+cmd+'` command found.\n'
|
||||||
'Please install it, visit: '+url)
|
'Please install it, visit: '+url)
|
||||||
logger.error(TRY_INSTALL_CHECK)
|
logger.error(TRY_INSTALL_CHECK)
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,15 @@ from . import log
|
||||||
|
|
||||||
logger = log.get_logger()
|
logger = log.get_logger()
|
||||||
WARNING_MIX = "Avoid using it in conjunction with IBoM native filtering options"
|
WARNING_MIX = "Avoid using it in conjunction with IBoM native filtering options"
|
||||||
|
PLUGIN_NAMES = ['InteractiveHtmlBom', 'InteractiveHtmlBom/InteractiveHtmlBom',
|
||||||
|
'org_openscopeproject_InteractiveHtmlBom/InteractiveHtmlBom']
|
||||||
RegDependency.register(ToolDependency('ibom', 'Interactive HTML BoM', URL_IBOM, url_down=URL_IBOM+'/releases',
|
RegDependency.register(ToolDependency('ibom', 'Interactive HTML BoM', URL_IBOM, url_down=URL_IBOM+'/releases',
|
||||||
command=CMD_IBOM, in_debian=False, no_cmd_line_version_old=True,
|
command=CMD_IBOM, in_debian=False, no_cmd_line_version_old=True,
|
||||||
plugin_dirs=['InteractiveHtmlBom', 'InteractiveHtmlBom/InteractiveHtmlBom'],
|
plugin_dirs=PLUGIN_NAMES, roles=ToolDependencyRole(version=(2, 4, 1, 4))))
|
||||||
roles=ToolDependencyRole(version=(2, 4, 1, 4))))
|
|
||||||
|
|
||||||
|
|
||||||
def check_tool():
|
def check_tool():
|
||||||
tool = search_as_plugin(CMD_IBOM, ['InteractiveHtmlBom', 'InteractiveHtmlBom/InteractiveHtmlBom'])
|
tool = search_as_plugin(CMD_IBOM, PLUGIN_NAMES)
|
||||||
check_script(tool, URL_IBOM)
|
check_script(tool, URL_IBOM)
|
||||||
return tool
|
return tool
|
||||||
|
|
||||||
|
|
@ -161,6 +162,9 @@ class IBoMOptions(VariantOptions):
|
||||||
else:
|
else:
|
||||||
output_dir = name
|
output_dir = name
|
||||||
cmd = [tool, GS.pcb_file, '--dest-dir', output_dir, '--no-browser', ]
|
cmd = [tool, GS.pcb_file, '--dest-dir', output_dir, '--no-browser', ]
|
||||||
|
if not os.access(tool, os.X_OK):
|
||||||
|
# Plugin could be installed without execute flags
|
||||||
|
cmd.insert(0, 'python3')
|
||||||
# Check if the user wants extra_fields but there is no data about them (#68)
|
# Check if the user wants extra_fields but there is no data about them (#68)
|
||||||
if self.need_extra_fields() and not os.path.isfile(self.extra_data_file):
|
if self.need_extra_fields() and not os.path.isfile(self.extra_data_file):
|
||||||
logger.warning(W_NONETLIST+'iBoM needs information about user defined fields and no netlist provided')
|
logger.warning(W_NONETLIST+'iBoM needs information about user defined fields and no netlist provided')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue