aboutsummaryrefslogtreecommitdiff
path: root/trygvis/eda/cli/make_bom.py
diff options
context:
space:
mode:
Diffstat (limited to 'trygvis/eda/cli/make_bom.py')
-rwxr-xr-xtrygvis/eda/cli/make_bom.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/trygvis/eda/cli/make_bom.py b/trygvis/eda/cli/make_bom.py
index 39d664b..eae7043 100755
--- a/trygvis/eda/cli/make_bom.py
+++ b/trygvis/eda/cli/make_bom.py
@@ -22,10 +22,12 @@ class Component(object):
def run(schematic_url, db_path):
- g = cli.open_database(db_path)
+ cli.with_database(db_path, lambda g: work(schematic_url, g))
+
+def work(schematic_url, g):
components = {}
- dkParts = {}
+ dk_parts = {}
cli.info("Loading components")
@@ -95,11 +97,11 @@ ORDER BY ?ref ?attr_type ?attr_value
for row in res:
pn = row.part_number
- if not hasattr(dkParts, pn):
+ if not hasattr(dk_parts, pn):
part = DigiKeyPart(pn)
- dkParts[pn] = part
+ dk_parts[pn] = part
else:
- part = dkParts[pn]
+ part = dk_parts[pn]
part.set_attribute(row.type, row.value)
cli.info('%5s: %-20s %s' % (pn, row.type + ':', row.value))