diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ee/order/templates/order.rst.j2 | 2 | ||||
-rw-r--r-- | src/ee/project/__init__.py | 3 | ||||
-rw-r--r-- | src/ee/tools/create_order.py | 2 | ||||
-rw-r--r-- | src/ee/tools/ninja.py | 10 | ||||
-rw-r--r-- | src/ee/tools/templates/build.ninja.j2 | 3 |
5 files changed, 13 insertions, 7 deletions
diff --git a/src/ee/order/templates/order.rst.j2 b/src/ee/order/templates/order.rst.j2 index 029665a..bc382a2 100644 --- a/src/ee/order/templates/order.rst.j2 +++ b/src/ee/order/templates/order.rst.j2 @@ -15,7 +15,7 @@ Part not resolved. {%- set pn=part|first_pn %} {%- set spn=part|first_spn %} Selected supplier: {{ from[0] }}{{ (", pn: " + pn.valueProp) if pn else "" }}{{ (", spn: " + spn.valueProp) if spn else "" }}. -Part: part-{{pn.valueProp}}_ +Part: `{{pn.valueProp}} <part-{{pn.valueProp}}_>`_ {% else %} MANY {% endif %} diff --git a/src/ee/project/__init__.py b/src/ee/project/__init__.py index 4bedd97..a1f042f 100644 --- a/src/ee/project/__init__.py +++ b/src/ee/project/__init__.py @@ -19,7 +19,8 @@ class Project(object): self._cfg = cfg @classmethod - def load(cls, project_dir: Path): + def load(cls): + project_dir = Path(".") cfg = load_config(project_dir) return Project(project_dir, cfg) diff --git a/src/ee/tools/create_order.py b/src/ee/tools/create_order.py index f493578..f2143a8 100644 --- a/src/ee/tools/create_order.py +++ b/src/ee/tools/create_order.py @@ -21,7 +21,7 @@ parser.add_argument("--part-db", args = parser.parse_args() -project = Project.load(Path(".")) +project = Project.load() part_db_dirs = [Path(part_db) for part_db in args.part_db] fail_on_missing_parts = False diff --git a/src/ee/tools/ninja.py b/src/ee/tools/ninja.py index ed8e91a..0987004 100644 --- a/src/ee/tools/ninja.py +++ b/src/ee/tools/ninja.py @@ -7,6 +7,7 @@ from typing import List, Union, Optional from jinja2 import Environment, PackageLoader, select_autoescape from ee.kicad import read_schematics +from ee.project import Project def ninja_path_filter(s: Union[Path, str, List[str]]) -> str: @@ -39,7 +40,7 @@ def noext_filter(s: Union[str, Path]) -> str: return os.path.splitext(os.path.basename(str(s)))[0] -def generate(sch_path: Path, kicad_bom_strategy: Optional[str]): +def generate(project: Project, sch_path: Path, kicad_bom_strategy: Optional[str]): def _create_env(): e = Environment( loader=PackageLoader(__name__, "templates"), @@ -60,7 +61,9 @@ def generate(sch_path: Path, kicad_bom_strategy: Optional[str]): part_dbs = [] params = { - "ee": "{} -m ee".format(os.path.relpath(sys.executable, Path("."))), "sch": sch_path, + "ee": "{} -m ee".format(os.path.relpath(sys.executable, Path("."))), + "project": project, + "sch": sch_path, "sch_files": sch_files, "kicad_bom_strategy": kicad_bom_strategy, "pcb": str(sch_path).replace(".sch", ".kicad_pcb"), "part_dbs": part_dbs, @@ -101,4 +104,5 @@ parser.add_argument("--kicad-bom-strategy", args = parser.parse_args() -generate(Path(args.sch), args.kicad_bom_strategy) +project = Project.load() +generate(project, Path(args.sch), args.kicad_bom_strategy) diff --git a/src/ee/tools/templates/build.ninja.j2 b/src/ee/tools/templates/build.ninja.j2 index 8552d96..9489aac 100644 --- a/src/ee/tools/templates/build.ninja.j2 +++ b/src/ee/tools/templates/build.ninja.j2 @@ -1,4 +1,5 @@ ee = {{ ee }} +report_dir = {{ project.report_dir }} sch = {{ sch | ninja_path }} sch_files = {{ sch_files | ninja_path }} pcb = {{ pcb | ninja_path }} @@ -71,7 +72,7 @@ build {{ out }}: import-parts-yaml {{ f }} # default {{ out }} {% endfor %} -build ee/order.xml: create-order ee/sch.xml {%- for p in part_dbs %} {{ p }}.xml{% endfor %} +build ee/order.xml | $report_dir/order.rst: create-order 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 %} |