diff service/iot2/tasks.py @ 1529:0e0713fd23e7

build: place generated nim in its own dir Ignore-this: 89c9a75595f0465d4efc44ef1b96abd7 darcs-hash:6a695011fe841ce7d6c020ebc33b6099ff26d964
author drewp <drewp@bigasterisk.com>
date Thu, 23 Jan 2020 23:59:41 -0800
parents 44aae4efedf6
children
line wrap: on
line diff
--- 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,