aboutsummaryrefslogtreecommitdiff
path: root/src/ee/tools
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-03-23 09:32:41 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2019-03-23 09:32:41 +0100
commitb230198488ef670ed6e374e0d39d5f4e6ac07e8d (patch)
tree38656bf7ba986e22a08ce21909856abedc4bd4fa /src/ee/tools
parent944e812879dbb0dd46d8d67e5aa34d5b420525d8 (diff)
downloadee-python-b230198488ef670ed6e374e0d39d5f4e6ac07e8d.tar.gz
ee-python-b230198488ef670ed6e374e0d39d5f4e6ac07e8d.tar.bz2
ee-python-b230198488ef670ed6e374e0d39d5f4e6ac07e8d.tar.xz
ee-python-b230198488ef670ed6e374e0d39d5f4e6ac07e8d.zip
order.rst.j2: Prettier internal links.
ninja: Name the generated .rst file for orders too.
Diffstat (limited to 'src/ee/tools')
-rw-r--r--src/ee/tools/create_order.py2
-rw-r--r--src/ee/tools/ninja.py10
-rw-r--r--src/ee/tools/templates/build.ninja.j23
3 files changed, 10 insertions, 5 deletions
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 %}