aboutsummaryrefslogtreecommitdiff
path: root/src/ee/tools
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2019-03-28 17:42:05 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2019-03-28 17:42:05 +0100
commitd9daf4c1d0abf0d93702e56028e8f746b0f475bc (patch)
treed0314f9eaf59059d7acc28d1dd3aa4e91540ad2c /src/ee/tools
parentfa85d46af0b91477cf354947df628af0dc0d2800 (diff)
downloadee-python-d9daf4c1d0abf0d93702e56028e8f746b0f475bc.tar.gz
ee-python-d9daf4c1d0abf0d93702e56028e8f746b0f475bc.tar.bz2
ee-python-d9daf4c1d0abf0d93702e56028e8f746b0f475bc.tar.xz
ee-python-d9daf4c1d0abf0d93702e56028e8f746b0f475bc.zip
seeed-download-opl
o Change to download one OPL at the time. Enables Ninja to run the downloads concurrently. init/ninja: o Learning about seeed-download-opl.
Diffstat (limited to 'src/ee/tools')
-rw-r--r--src/ee/tools/init.py7
-rw-r--r--src/ee/tools/seeed_download_opl.py10
-rw-r--r--src/ee/tools/templates/build.ninja.j215
3 files changed, 28 insertions, 4 deletions
diff --git a/src/ee/tools/init.py b/src/ee/tools/init.py
index 81bdda3..f87c958 100644
--- a/src/ee/tools/init.py
+++ b/src/ee/tools/init.py
@@ -7,7 +7,6 @@ import configparser
def init_kicad_project(basedir: Path, cfg):
- print("basedir={}".format(basedir))
pro_files: List[Path] = [f for f in basedir.iterdir() if f.name.endswith(".pro")]
if len(pro_files) == 0:
@@ -30,11 +29,17 @@ def init_kicad_project(basedir: Path, cfg):
print("Found more than one kicad project file.")
+def init_seeed_opl(project: Project):
+ import ee.supplier.seeed
+ ee.supplier.seeed.init_project(project)
+
+
def init(project_dir: Path, basedir: Path):
cfg = configparser.ConfigParser()
project = Project(project_dir, cfg)
init_kicad_project(basedir, cfg)
+ init_seeed_opl(project)
print("Saving project. Now run 'ee ninja' to generate Ninja build file")
project.save()
diff --git a/src/ee/tools/seeed_download_opl.py b/src/ee/tools/seeed_download_opl.py
index e53361f..3f8b07b 100644
--- a/src/ee/tools/seeed_download_opl.py
+++ b/src/ee/tools/seeed_download_opl.py
@@ -5,12 +5,16 @@ from ee.supplier import seeed
parser = argparse.ArgumentParser()
-parser.add_argument("--out-dir",
+parser.add_argument("--out",
required=True,
- metavar="DIR FOR PART DBS")
+ metavar="PART DB")
+
+parser.add_argument("--opl",
+ required=True,
+ metavar="OPL")
args = parser.parse_args()
cache_dir = ".ee/cache/seeed"
-seeed.download_opls(Path(args.out_dir), Path(cache_dir))
+seeed.download_opl(Path(args.out), Path(cache_dir), args.opl)
diff --git a/src/ee/tools/templates/build.ninja.j2 b/src/ee/tools/templates/build.ninja.j2
index 080ac65..227b68c 100644
--- a/src/ee/tools/templates/build.ninja.j2
+++ b/src/ee/tools/templates/build.ninja.j2
@@ -82,3 +82,18 @@ build ee/order.xml | $report_dir/order.rst: create-order ee/sch.xml {%- for p in
part_dbs ={%- for p in part_dbs %} {{ p }}.xml{% endfor %}
default ee/order.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(",") -%}
+build seeed-download-opls: phony{%- for opl in opls %} ee/seeed/opl/{{ opl.strip() }}.xml{% endfor %}
+{%- for opl in opls %}
+{% set opl=opl.strip() -%}
+
+build ee/seeed/opl/{{ opl }}.xml: seeed-download-opl
+ opl = {{ opl }}
+{% endfor -%}
+{% endif -%}