]> Repositories - Adafruit_Blinka-hackapet.git/blob - test/scripts/upload_feather_huzzah_micropython_put.sh
Merge pull request #377 from scottamain/mini
[Adafruit_Blinka-hackapet.git] / test / scripts / upload_feather_huzzah_micropython_put.sh
1 #!/bin/sh
2 PORT=/dev/ttyUSB0
3
4 export MPYCROSS=`realpath ../../../micropython/mpy-cross/mpy-cross`
5
6 # switch to test sources
7 cd ../src
8 # create test source directories on board
9 find testing -type d | \
10         grep -v -E "(^./.git.*|^./.idea|^./.vscode|__pycache__)" | \
11         xargs -n1 -I {} sh -c "echo Creating directory {} ...; ampy --port ${PORT} mkdir --exists-okay  {}"
12 # compile source .py files to .mpy
13 find . -type f -name '*.py' | \
14     xargs -n1 -I {} sh -c "echo compiling {} ...; ${MPYCROSS} {}"
15 # upload bytecode .mpy files
16 find . -type f -name '*.mpy' | \
17         xargs -n1 -I {} sh -c "echo uploading {} ...; ampy --port ${PORT} put {} {}"
18
19 #switch to test libraries
20 cd ../libraries/
21
22 # Compile adafruit libraries to bytecode and upload
23 for SUBMODULE in `find . -mindepth 1 -maxdepth 1 -type d `
24 do
25     cd ${SUBMODULE}
26     # create adafruit library directories on board
27     find . -mindepth 1 -type d | \
28             grep -v -E "(^./.git.*|__pycache__|^./doc.*|^./example.*)" | \
29             xargs -n1 -I {} sh -c "echo Creating directory {} ...; ampy --port ${PORT} mkdir --exists-okay  {}"
30     # compile adafruit library .py files to .mpy
31     find . -type f -name '*.py' | \
32         grep -v -E "(^./conf.py|^./docs/conf.py|^./setup.py|^./example.*)" | \
33         xargs -n1 -I {} sh -c "echo compiling {} ...; ${MPYCROSS} {}"
34     # upload adafruit library .mpy files
35     find . -type f -name '*.mpy' | \
36         xargs -n1 -I {} sh -c "echo uploading {} ...; ampy --port ${PORT} put {} {}"
37     cd ../
38 done
39
40 # switch to adafruit_blinka source
41 cd ../../src
42
43 find . -mindepth 1 -type d | \
44         grep -v -E "(^./.git.*|__pycache__)" | \
45         xargs -n1 -I {} sh -c "echo Creating directory {} ...; ampy --port ${PORT} mkdir --exists-okay  {}"
46 # compile adafruit blinka .py files to .mpy
47 find . -type f -name '*.py' | \
48     xargs -n1 -I {} sh -c "echo compiling {} ...; ${MPYCROSS} {}"
49 # upload adafruit blinka .mpy files
50 find . -type f -name '*.mpy' | \
51     xargs -n1 -I {} sh -c "echo uploading {} ...; ampy --port ${PORT} put {} {}"