comparison 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
comparison
equal deleted inserted replaced
1528:44aae4efedf6 1529:0e0713fd23e7
24 ctx.run(f'virtualenv -p /usr/bin/python3.7 {PY_ENV}') 24 ctx.run(f'virtualenv -p /usr/bin/python3.7 {PY_ENV}')
25 # now .../wheel is newer than requirements.txt 25 # now .../wheel is newer than requirements.txt
26 26
27 @task(pre=[py_install]) 27 @task(pre=[py_install])
28 def py_deps(ctx): 28 def py_deps(ctx):
29 pip_install_ever_ran = SOME_PY_DEP.exists() 29 pip_installed = Path(f'{PY_SITE_PACKAGES}/.pip_last_install')
30 pip_install_last_ran = Path(f'{PY_SITE_PACKAGES}/wheel').stat().st_mtime
31 requirements = Path('requirements.txt').stat().st_mtime 30 requirements = Path('requirements.txt').stat().st_mtime
32 if pip_install_ever_ran and pip_install_last_ran > requirements: 31 if pip_installed.exists() and pip_installed.stat().st_mtime > requirements:
33 return 32 return
34 ctx.run(f'{PY_ENV}/bin/pip install ' 33 ctx.run(f'{PY_ENV}/bin/pip install '
35 #f'--quiet ' 34 #f'--quiet '
36 f'--index-url https://projects.bigasterisk.com/ ' 35 f'--index-url https://projects.bigasterisk.com/ '
37 f'--extra-index-url https://pypi.org/simple ' 36 f'--extra-index-url https://pypi.org/simple '
38 f'-r requirements.txt') 37 f'-r requirements.txt')
38 ctx.run(f'touch {str(pip_installed)}')
39 39
40 @task(pre=[nim_install]) 40 @task(pre=[nim_install])
41 def nim_deps(ctx): 41 def nim_deps(ctx):
42 pkgs = [('nimpy', 'nimpy-0.1.0'), 42 pkgs = [('nimpy', 'nimpy-0.1.0'),
43 ('https://github.com/avsej/capnp.nim.git', 'capnp-0.0.3'), 43 ('https://github.com/avsej/capnp.nim.git', 'capnp-0.0.3'),
82 ctx.run(f'cd build/capnp.nim; ./build.sh') 82 ctx.run(f'cd build/capnp.nim; ./build.sh')
83 ctx.run(f'cd build/capnp.nim; bin/nim c capnp/capnpc.nim') 83 ctx.run(f'cd build/capnp.nim; bin/nim c capnp/capnpc.nim')
84 84
85 @task 85 @task
86 def messages_build_nim(ctx): 86 def messages_build_nim(ctx):
87 Path('build/nim_capn').mkdir(exist_ok=True)
87 ctx.run(f'capnp compile ' 88 ctx.run(f'capnp compile '
88 f'-o ./build/capnp.nim/capnp/capnpc ' 89 f'-o ./build/capnp.nim/capnp/capnpc '
89 f'messages.capnp > build/messages.nim') 90 f'messages.capnp > build/nim_capn/messages.nim')
90 91
91 if 0: 92 if 0:
92 # maybe esp32 should be done as extra c files in an esphome build, 93 # maybe esp32 should be done as extra c files in an esphome build,
93 # not ESP-IDF from scratch 94 # not ESP-IDF from scratch
94 95