aboutsummaryrefslogtreecommitdiff
path: root/src/ee/tools
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-02-21 11:21:12 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2019-02-21 11:21:12 +0100
commitd9cf71000fb7c2197d05bae1c7bce47af5297aa5 (patch)
tree6e3bf56590ebd51dd6744193f44609a33d183a12 /src/ee/tools
parentb9c8e02072ea6da04ddc9fe9795f699697f25d07 (diff)
downloadee-python-d9cf71000fb7c2197d05bae1c7bce47af5297aa5.tar.gz
ee-python-d9cf71000fb7c2197d05bae1c7bce47af5297aa5.tar.bz2
ee-python-d9cf71000fb7c2197d05bae1c7bce47af5297aa5.tar.xz
ee-python-d9cf71000fb7c2197d05bae1c7bce47af5297aa5.zip
Trying a new way to generate way to generate files.
Diffstat (limited to 'src/ee/tools')
-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)