diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2019-05-20 15:27:38 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2019-05-20 15:27:38 +0200 |
commit | 9eba62ef1d6b4896de693976116f69a9692332d9 (patch) | |
tree | 98ae9fdf48818206a6db552938c53e35abf1c45d /src/ee/tools/part_find_requirements.py | |
parent | def66a1bd81283d38b468b66ff6e4e34621a5ce2 (diff) | |
download | ee-python-9eba62ef1d6b4896de693976116f69a9692332d9.tar.gz ee-python-9eba62ef1d6b4896de693976116f69a9692332d9.tar.bz2 ee-python-9eba62ef1d6b4896de693976116f69a9692332d9.tar.xz ee-python-9eba62ef1d6b4896de693976116f69a9692332d9.zip |
ee:
o Adding FactType as a smaller wrapper around the fact uri.
o Adding ee.part.Facts, used as Part.facts
o Renaming 'type' uri to 'ee-component-type'.
kicad-make-bom: Removing strategy functionality, replaced with
part-apply-function. Moving default strategy contents into
ee.kicad.functions.
Diffstat (limited to 'src/ee/tools/part_find_requirements.py')
-rw-r--r-- | src/ee/tools/part_find_requirements.py | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/ee/tools/part_find_requirements.py b/src/ee/tools/part_find_requirements.py new file mode 100644 index 0000000..032db02 --- /dev/null +++ b/src/ee/tools/part_find_requirements.py @@ -0,0 +1,39 @@ +import argparse +from pathlib import Path + +from ee.part import requirement, Part, PartDb, load_db, save_db + + +def work(in_path: Path, out_path: Path): + in_parts = load_db(in_path) + + with out_path.open("w") as f: + print("<root>", file=f) + for xml in in_parts.iterparts(): + part = Part(xml) + + analysis = requirement.analyze_requirements(part) + + print("Part: {}. Found {} requirements".format(analysis.part.printable_reference, + len(analysis.requirements)), file=f) + + for r in analysis.requirements: + print(" {}".format(r), file=f) + + print("</root>", file=f) + + +parser = argparse.ArgumentParser() + +parser.add_argument("--in", + dest="in_path", + required=True, + metavar="PART DB") + +parser.add_argument("--out", + required=True, + metavar="REQUIREMENTS") + +args = parser.parse_args() + +work(Path(args.in_path), Path(args.out)) |