aboutsummaryrefslogtreecommitdiff
path: root/src/ee/tools/kicad_make_bom.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/ee/tools/kicad_make_bom.py')
-rw-r--r--src/ee/tools/kicad_make_bom.py24
1 files changed, 8 insertions, 16 deletions
diff --git a/src/ee/tools/kicad_make_bom.py b/src/ee/tools/kicad_make_bom.py
index 2600968..769ea0d 100644
--- a/src/ee/tools/kicad_make_bom.py
+++ b/src/ee/tools/kicad_make_bom.py
@@ -1,8 +1,6 @@
import argparse
-import ee.kicad as kicad
-from ee.tools import mk_parents
-from xml.etree import ElementTree
-from xml.dom import minidom
+
+from ee.kicad.make_bom import make_bom
pretty = True # we always pretty print the XML
@@ -17,19 +15,13 @@ parser.add_argument("--out",
metavar="FILE",
help="The output file")
-args = parser.parse_args()
+parser.add_argument("--strategy",
+ metavar="FUNC")
-sch = kicad.read_schematics(args.sch)
+args = parser.parse_args()
-bom = kicad.to_bom_xml(sch)
-xml = ElementTree.tostring(bom, encoding='unicode')
+new_mode = True
-if pretty:
- xml = minidom.parseString(xml).toprettyxml(indent=" ")
+strategy = args.strategy if args.strategy else "ee.kicad.make_bom.MakeBomStrategy"
-if args.out:
- mk_parents(args.out)
- with open(args.out, "w") as f:
- f.write(xml)
-else:
- print(xml)
+make_bom(args.sch, args.out, strategy, new_mode, pretty)