changeset 729:810ca0863490

build: place generated nim in its own dir Ignore-this: 89c9a75595f0465d4efc44ef1b96abd7
author drewp@bigasterisk.com
date Thu, 23 Jan 2020 23:59:41 -0800
parents 17ff9322328b
children 50f26defcd4d
files service/iot2/nim.cfg service/iot2/tasks.py
diffstat 2 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/service/iot2/nim.cfg	Thu Jan 23 23:46:34 2020 -0800
+++ b/service/iot2/nim.cfg	Thu Jan 23 23:59:41 2020 -0800
@@ -1,3 +1,4 @@
 nimcache = "build/nimcache"
 hint[Processing] = off
--d:nimOldCaseObjects
\ No newline at end of file
+-d:nimOldCaseObjects
+path = "build/nim_capn"
--- a/service/iot2/tasks.py	Thu Jan 23 23:46:34 2020 -0800
+++ b/service/iot2/tasks.py	Thu Jan 23 23:59:41 2020 -0800
@@ -26,16 +26,16 @@
 
 @task(pre=[py_install])
 def py_deps(ctx):
-    pip_install_ever_ran = SOME_PY_DEP.exists()
-    pip_install_last_ran = Path(f'{PY_SITE_PACKAGES}/wheel').stat().st_mtime
+    pip_installed = Path(f'{PY_SITE_PACKAGES}/.pip_last_install')
     requirements = Path('requirements.txt').stat().st_mtime
-    if pip_install_ever_ran and pip_install_last_ran > requirements:
+    if pip_installed.exists() and pip_installed.stat().st_mtime > requirements:
         return
     ctx.run(f'{PY_ENV}/bin/pip install '
             #f'--quiet '
             f'--index-url https://projects.bigasterisk.com/ '
             f'--extra-index-url https://pypi.org/simple '
             f'-r requirements.txt')
+    ctx.run(f'touch {str(pip_installed)}')
 
 @task(pre=[nim_install])
 def nim_deps(ctx):
@@ -84,9 +84,10 @@
 
 @task
 def messages_build_nim(ctx):
+    Path('build/nim_capn').mkdir(exist_ok=True)
     ctx.run(f'capnp compile '
             f'-o ./build/capnp.nim/capnp/capnpc '
-            f'messages.capnp > build/messages.nim')
+            f'messages.capnp > build/nim_capn/messages.nim')
 
 if 0:
     # maybe esp32 should be done as extra c files in an esphome build,