diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2019-08-15 13:33:29 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2019-08-15 13:33:29 +0200 |
commit | db80ff609d570f6074eb35758304a0141a24050a (patch) | |
tree | bce0a801e1ca0046b5e3ee02d32bffc3457709c7 /src/ee/bom.py | |
parent | f328b015085be3eab7800e6f87cf1ae704486c0a (diff) | |
download | ee-python-db80ff609d570f6074eb35758304a0141a24050a.tar.gz ee-python-db80ff609d570f6074eb35758304a0141a24050a.tar.bz2 ee-python-db80ff609d570f6074eb35758304a0141a24050a.tar.xz ee-python-db80ff609d570f6074eb35758304a0141a24050a.zip |
create-bom: Add support for passing arguments to tool. Implement
fail_on_missing_parts in the CLI.
ee: Add StopToolException, makes for a more graceful exit(1) if a tool
wants to stop immediately.
Diffstat (limited to 'src/ee/bom.py')
-rw-r--r-- | src/ee/bom.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ee/bom.py b/src/ee/bom.py index 96da25a..e12260c 100644 --- a/src/ee/bom.py +++ b/src/ee/bom.py @@ -3,7 +3,7 @@ import pydoc from pathlib import Path from typing import List, Optional -from ee import EeException +from ee import EeException, StopToolException from ee.db import ObjDb from ee.logging import log from ee.part import PartDb, load_db, save_db, Part, fact_keys @@ -134,12 +134,12 @@ def create_bom(project: Project, schematic_path: Path, out_path: Path, part_dbs: bom_parts.add_multi_index("supplier,part", lambda op: ( op.selected_part.supplier, op.selected_part.uri) if op.selected_part else None) - if len(unresolved_parts) and fail_on_missing_parts: - raise EeException("The bom has parts that can't be found from any supplier") - out_file = project.report_dir / (os.path.splitext(out_path.name)[0] + ".rst") make_report(out_file, unresolved_parts, bom_parts, supplier_parts) + if len(unresolved_parts) and fail_on_missing_parts: + raise StopToolException("The bom has parts that can't be found from any supplier") + out_parts = PartDb() found_parts = 0 for bom_part in bom_parts: |