Added support for iBoM as plugin to the checker

This commit is contained in:
Salvador E. Tropea 2022-05-26 09:39:24 -03:00
parent 0a3dff85f2
commit 9b6b336847
2 changed files with 106 additions and 85 deletions

View File

@ -147,21 +147,21 @@ deps = '{\
"name": "ImageMagick",\
"no_cmd_line_version": false,\
"no_cmd_line_version_old": false,\
"output": "pcbdraw",\
"output": "pcb_print",\
"plugin_dirs": null,\
"pypi_name": "ImageMagick",\
"roles": [\
{\
"desc": "Create JPG images",\
"mandatory": false,\
"output": "pcbdraw",\
"version": null\
},\
{\
"desc": "Create monochrome prints",\
"mandatory": false,\
"output": "pcb_print",\
"version": null\
},\
{\
"desc": "Create JPG images",\
"mandatory": false,\
"output": "pcbdraw",\
"version": null\
}\
],\
"url": "https://imagemagick.org/",\
@ -182,7 +182,8 @@ deps = '{\
"output": "ibom",\
"plugin_dirs": [\
"InteractiveHtmlBom",\
"InteractiveHtmlBom/InteractiveHtmlBom"\
"InteractiveHtmlBom/InteractiveHtmlBom",\
"org_openscopeproject_InteractiveHtmlBom/InteractiveHtmlBom"\
],\
"pypi_name": "Interactive HTML BoM",\
"roles": [\
@ -243,10 +244,62 @@ deps = '{\
"name": "KiCad Automation tools",\
"no_cmd_line_version": false,\
"no_cmd_line_version_old": false,\
"output": "svg_pcb_print",\
"output": "step",\
"plugin_dirs": null,\
"pypi_name": "kiauto",\
"roles": [\
{\
"desc": null,\
"mandatory": true,\
"output": "step",\
"version": [\
1,\
6,\
1\
]\
},\
{\
"desc": null,\
"mandatory": true,\
"output": "netlist",\
"version": [\
1,\
6,\
11\
]\
},\
{\
"desc": null,\
"mandatory": true,\
"output": "render_3d",\
"version": [\
1,\
6,\
8\
]\
},\
{\
"desc": null,\
"mandatory": true,\
"output": "svg_sch_print",\
"version": null\
},\
{\
"desc": null,\
"mandatory": true,\
"output": "pdf_pcb_print",\
"version": [\
1,\
6,\
7\
]\
},\
{\
"desc": null,\
"mandatory": true,\
"output": "pdf_sch_print",\
"version": null\
},\
{\
"desc": null,\
"mandatory": true,\
@ -267,58 +320,6 @@ deps = '{\
5\
]\
},\
{\
"desc": null,\
"mandatory": true,\
"output": "svg_sch_print",\
"version": null\
},\
{\
"desc": null,\
"mandatory": true,\
"output": "pdf_sch_print",\
"version": null\
},\
{\
"desc": null,\
"mandatory": true,\
"output": "pdf_pcb_print",\
"version": [\
1,\
6,\
7\
]\
},\
{\
"desc": null,\
"mandatory": true,\
"output": "netlist",\
"version": [\
1,\
6,\
11\
]\
},\
{\
"desc": null,\
"mandatory": true,\
"output": "step",\
"version": [\
1,\
6,\
1\
]\
},\
{\
"desc": null,\
"mandatory": true,\
"output": "render_3d",\
"version": [\
1,\
6,\
8\
]\
},\
{\
"desc": null,\
"mandatory": true,\
@ -328,13 +329,13 @@ deps = '{\
{\
"desc": null,\
"mandatory": true,\
"output": "update_xml",\
"output": "run_drc",\
"version": null\
},\
{\
"desc": null,\
"mandatory": true,\
"output": "run_drc",\
"output": "update_xml",\
"version": null\
}\
],\
@ -353,20 +354,10 @@ deps = '{\
"name": "KiCost",\
"no_cmd_line_version": false,\
"no_cmd_line_version_old": false,\
"output": "kicost",\
"output": "bom",\
"plugin_dirs": null,\
"pypi_name": "KiCost",\
"roles": [\
{\
"desc": null,\
"mandatory": true,\
"output": "kicost",\
"version": [\
1,\
1,\
7\
]\
},\
{\
"desc": "Find components costs and specs",\
"mandatory": false,\
@ -376,6 +367,16 @@ deps = '{\
1,\
8\
]\
},\
{\
"desc": null,\
"mandatory": true,\
"output": "kicost",\
"version": [\
1,\
1,\
7\
]\
}\
],\
"url": "https://github.com/INTI-CMNB/KiCost",\
@ -559,21 +560,21 @@ deps = '{\
"name": "RSVG tools",\
"no_cmd_line_version": false,\
"no_cmd_line_version_old": false,\
"output": "pcbdraw",\
"output": "pcb_print",\
"plugin_dirs": null,\
"pypi_name": "RSVG tools",\
"roles": [\
{\
"desc": "Create PNG and JPG images",\
"mandatory": false,\
"output": "pcbdraw",\
"version": null\
},\
{\
"desc": "Create PDF, PNG, EPS and PS formats",\
"mandatory": false,\
"output": "pcb_print",\
"version": null\
},\
{\
"desc": "Create PNG and JPG images",\
"mandatory": false,\
"output": "pcbdraw",\
"version": null\
}\
],\
"url": "https://cran.r-project.org/web/packages/rsvg/index.html",\
@ -690,8 +691,9 @@ def search_as_plugin(cmd, names):
for dir in kicad_plugins_dirs:
for name in names:
fname = os.path.join(dir, name, cmd)
# print('Trying '+fname)
if os.path.isfile(fname):
logger.debug('Using `{}` for `{}` ({})'.format(fname, cmd, name))
# print('Using `{}` for `{}` ({})'.format(fname, cmd, name))
return fname
return cmd
@ -862,6 +864,7 @@ else:
sev = 4
print('Python: '+do_color(sys.version.replace('\n', ' '), sev))
# KiCad
home = None
try:
import pcbnew
kicad_ok = True
@ -878,6 +881,7 @@ try:
# /usr/share/kicad/*
kicad_plugins_dirs.append(os.path.join(kicad_share_path, 'scripting'))
kicad_plugins_dirs.append(os.path.join(kicad_share_path, 'scripting', 'plugins'))
kicad_plugins_dirs.append(os.path.join(kicad_share_path, '3rdparty', 'plugins')) # KiCad 6.0 PCM
# ~/.config/kicad/*
if kicad_conf_path:
kicad_plugins_dirs.append(os.path.join(kicad_conf_path, 'scripting'))
@ -900,6 +904,10 @@ if kicad_ok:
error("Unable to detect KiCad version, got: `{}`".format(version))
else:
kicad_version = (int(m.group(1)), int(m.group(2)), int(m.group(3)))
if kicad_version[0] >= 6 and home:
# KiCad 6.0 PCM
ver_dir = str(kicad_version[0])+'.'+str(kicad_version[1])
kicad_plugins_dirs.append(os.path.join(home, '.local', 'share', 'kicad', ver_dir, '3rdparty', 'plugins'))
except:
version = 'Older than 5.1.6'
else:
@ -956,7 +964,10 @@ for name, d in dependencies.items():
if d['no_cmd_line_version']:
version = 'Ok ({})'.format(command) if which(command) is not None else NOT_AVAIL
else:
version = run_command([command, d['help_option']], no_err_2=d['no_cmd_line_version_old'])
cmd = [command, d['help_option']]
if d['is_kicad_plugin']:
cmd.insert(0, 'python3')
version = run_command(cmd, no_err_2=d['no_cmd_line_version_old'])
sev, ver = check_version(version, d['roles'])
d['sev'] = sev
print(name+': '+do_color(version, sev, version=ver))

View File

@ -72,8 +72,9 @@ def search_as_plugin(cmd, names):
for dir in kicad_plugins_dirs:
for name in names:
fname = os.path.join(dir, name, cmd)
# print('Trying '+fname)
if os.path.isfile(fname):
logger.debug('Using `{}` for `{}` ({})'.format(fname, cmd, name))
# print('Using `{}` for `{}` ({})'.format(fname, cmd, name))
return fname
return cmd
@ -244,6 +245,7 @@ else:
sev = 4
print('Python: '+do_color(sys.version.replace('\n', ' '), sev))
# KiCad
home = None
try:
import pcbnew
kicad_ok = True
@ -260,6 +262,7 @@ try:
# /usr/share/kicad/*
kicad_plugins_dirs.append(os.path.join(kicad_share_path, 'scripting'))
kicad_plugins_dirs.append(os.path.join(kicad_share_path, 'scripting', 'plugins'))
kicad_plugins_dirs.append(os.path.join(kicad_share_path, '3rdparty', 'plugins')) # KiCad 6.0 PCM
# ~/.config/kicad/*
if kicad_conf_path:
kicad_plugins_dirs.append(os.path.join(kicad_conf_path, 'scripting'))
@ -282,6 +285,10 @@ if kicad_ok:
error("Unable to detect KiCad version, got: `{}`".format(version))
else:
kicad_version = (int(m.group(1)), int(m.group(2)), int(m.group(3)))
if kicad_version[0] >= 6 and home:
# KiCad 6.0 PCM
ver_dir = str(kicad_version[0])+'.'+str(kicad_version[1])
kicad_plugins_dirs.append(os.path.join(home, '.local', 'share', 'kicad', ver_dir, '3rdparty', 'plugins'))
except:
version = 'Older than 5.1.6'
else:
@ -338,7 +345,10 @@ for name, d in dependencies.items():
if d['no_cmd_line_version']:
version = 'Ok ({})'.format(command) if which(command) is not None else NOT_AVAIL
else:
version = run_command([command, d['help_option']], no_err_2=d['no_cmd_line_version_old'])
cmd = [command, d['help_option']]
if d['is_kicad_plugin']:
cmd.insert(0, 'python3')
version = run_command(cmd, no_err_2=d['no_cmd_line_version_old'])
sev, ver = check_version(version, d['roles'])
d['sev'] = sev
print(name+': '+do_color(version, sev, version=ver))