From e47a988e624e75ab3c0bac32041668647ab2a0f1 Mon Sep 17 00:00:00 2001 From: Trygve Laugstøl Date: Tue, 2 Apr 2019 06:43:53 +0200 Subject: o Renaming create-order to create-bom. --- src/ee/tools/create_bom.py | 31 +++++++++++++++++++++++++++++++ src/ee/tools/create_order.py | 31 ------------------------------- src/ee/tools/init.py | 8 ++++---- src/ee/tools/templates/build.ninja.j2 | 20 ++++++++++---------- 4 files changed, 45 insertions(+), 45 deletions(-) create mode 100644 src/ee/tools/create_bom.py delete mode 100644 src/ee/tools/create_order.py (limited to 'src/ee/tools') diff --git a/src/ee/tools/create_bom.py b/src/ee/tools/create_bom.py new file mode 100644 index 0000000..19521ce --- /dev/null +++ b/src/ee/tools/create_bom.py @@ -0,0 +1,31 @@ +import argparse +from pathlib import Path + +from ee.bom import create_bom +from ee.project import Project + +parser = argparse.ArgumentParser() + +parser.add_argument("--schematic", + required=True, + metavar="PART DB") + +parser.add_argument("--out", + required=True, + metavar="PART DB") + +parser.add_argument("--part-db", + nargs="*", + required=True, + metavar="PART DB") + +parser.add_argument("--strategy", + metavar="FUNC") + +args = parser.parse_args() + +project = Project.load() +part_db_dirs = [Path(part_db) for part_db in args.part_db] +fail_on_missing_parts = False + +create_bom(project, Path(args.schematic), Path(args.out), part_db_dirs, fail_on_missing_parts, args.strategy) diff --git a/src/ee/tools/create_order.py b/src/ee/tools/create_order.py deleted file mode 100644 index d740ff2..0000000 --- a/src/ee/tools/create_order.py +++ /dev/null @@ -1,31 +0,0 @@ -import argparse -from pathlib import Path - -from ee.order import create_order -from ee.project import Project - -parser = argparse.ArgumentParser() - -parser.add_argument("--schematic", - required=True, - metavar="PART DB") - -parser.add_argument("--out", - required=True, - metavar="PART DB") - -parser.add_argument("--part-db", - nargs="*", - required=True, - metavar="PART DB") - -parser.add_argument("--strategy", - metavar="FUNC") - -args = parser.parse_args() - -project = Project.load() -part_db_dirs = [Path(part_db) for part_db in args.part_db] -fail_on_missing_parts = False - -create_order(project, Path(args.schematic), Path(args.out), part_db_dirs, fail_on_missing_parts, args.strategy) diff --git a/src/ee/tools/init.py b/src/ee/tools/init.py index 74a67d1..c3d7e41 100644 --- a/src/ee/tools/init.py +++ b/src/ee/tools/init.py @@ -44,9 +44,9 @@ def init(project_dir: Path, basedir: Path, args): init_kicad_project(basedir, cfg, args) init_seeed_opl(project) - if args.create_order_strategy: - project.cfg.add_section("create-order") - project.cfg["create-order"]["strategy"] = args.create_order_strategy + if args.create_bom_strategy: + project.cfg.add_section("create-bom") + project.cfg["create-bom"]["strategy"] = args.create_bom_strategy print("Saving project. Now run 'ee ninja' to generate Ninja build file") project.save() @@ -61,7 +61,7 @@ parser.add_argument("--kicad-bom-strategy", required=False, metavar="PY CALLABLE") -parser.add_argument("--create-order-strategy", +parser.add_argument("--create-bom-strategy", required=False, metavar="PY CALLABLE") diff --git a/src/ee/tools/templates/build.ninja.j2 b/src/ee/tools/templates/build.ninja.j2 index 2a56bdc..23bef37 100644 --- a/src/ee/tools/templates/build.ninja.j2 +++ b/src/ee/tools/templates/build.ninja.j2 @@ -41,9 +41,9 @@ rule element14-normalize-facts description = element14-normalize-facts command = $ee element14-normalize-facts --in $in --out $out -rule create-order - description = create-order - command = $ee create-order --schematic $schematic --part-db $part_dbs --out $out $strategy +rule create-bom + description = create-bom + command = $ee create-bom --schematic $schematic --part-db $part_dbs --out $out $strategy rule import-parts-yaml description = import-parts-yaml $in @@ -79,21 +79,21 @@ build {{ out }}: import-parts-yaml {{ f }} # default {{ out }} {% endfor %} -build ee/order.xml | $report_dir/order.rst: create-order ee/sch.xml {%- for p in part_dbs %} {{ p }}.xml{% endfor %} +build ee/bom.xml | $report_dir/bom.rst: create-bom ee/sch.xml {%- for p in part_dbs %} {{ p }}.xml{% endfor %} schematic = ee/sch.xml part_dbs ={%- for p in part_dbs %} {{ p }}.xml{% endfor %} -{%- if project.cfg["create-order"] and project.cfg["create-order"]["strategy"] %} - strategy = --strategy {{ project.cfg["create-order"]["strategy"] }} +{%- if project.cfg["create-bom"] and project.cfg["create-bom"]["strategy"] %} + strategy = --strategy {{ project.cfg["create-bom"]["strategy"] }} {%- endif %} -default ee/order.xml +default ee/bom.xml rule seeed-download-opl description = seeed-download-opl $opl command = $ee seeed-download-opl --out $out --opl $opl -{%- if project.cfg.has_section("seeed-opl") -%} -{% set opls=project.cfg["seeed-opl"]["opls"].split(",") -%} +{% if project.cfg.has_section("seeed-opl") %} +{%- set opls=project.cfg["seeed-opl"]["opls"].split(",") -%} build seeed-download-opls: phony{%- for opl in opls %} ee/seeed/opl/{{ opl.strip() }}.xml{% endfor %} {%- for opl in opls %} {% set opl=opl.strip() -%} @@ -101,4 +101,4 @@ build seeed-download-opls: phony{%- for opl in opls %} ee/seeed/opl/{{ opl.strip build ee/seeed/opl/{{ opl }}.xml: seeed-download-opl opl = {{ opl }} {% endfor -%} -{% endif %} +{% endif -%} -- cgit v1.2.3