2 # SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
4 # SPDX-License-Identifier: MIT
7 export MPYCROSS=`realpath ../../../micropython/mpy-cross/mpy-cross`
9 # switch to test sources
11 # create test source directories on board
12 find testing -type d | \
13 grep -v -E "(^./.git.*|^./.idea|^./.vscode|__pycache__)" | \
14 xargs -n1 -I {} sh -c "echo Creating directory {} ...; ampy --port ${PORT} mkdir --exists-okay {}"
15 # compile source .py files to .mpy
16 find . -type f -name '*.py' | \
17 xargs -n1 -I {} sh -c "echo compiling {} ...; ${MPYCROSS} {}"
18 # upload bytecode .mpy files
19 find . -type f -name '*.mpy' | \
20 xargs -n1 -I {} sh -c "echo uploading {} ...; ampy --port ${PORT} put {} {}"
22 #switch to test libraries
25 # Compile adafruit libraries to bytecode and upload
26 for SUBMODULE in `find . -mindepth 1 -maxdepth 1 -type d `
29 # create adafruit library directories on board
30 find . -mindepth 1 -type d | \
31 grep -v -E "(^./.git.*|__pycache__|^./doc.*|^./example.*)" | \
32 xargs -n1 -I {} sh -c "echo Creating directory {} ...; ampy --port ${PORT} mkdir --exists-okay {}"
33 # compile adafruit library .py files to .mpy
34 find . -type f -name '*.py' | \
35 grep -v -E "(^./conf.py|^./docs/conf.py|^./setup.py|^./example.*)" | \
36 xargs -n1 -I {} sh -c "echo compiling {} ...; ${MPYCROSS} {}"
37 # upload adafruit library .mpy files
38 find . -type f -name '*.mpy' | \
39 xargs -n1 -I {} sh -c "echo uploading {} ...; ampy --port ${PORT} put {} {}"
43 # switch to adafruit_blinka source
46 find . -mindepth 1 -type d | \
47 grep -v -E "(^./.git.*|__pycache__)" | \
48 xargs -n1 -I {} sh -c "echo Creating directory {} ...; ampy --port ${PORT} mkdir --exists-okay {}"
49 # compile adafruit blinka .py files to .mpy
50 find . -type f -name '*.py' | \
51 xargs -n1 -I {} sh -c "echo compiling {} ...; ${MPYCROSS} {}"
52 # upload adafruit blinka .mpy files
53 find . -type f -name '*.mpy' | \
54 xargs -n1 -I {} sh -c "echo uploading {} ...; ampy --port ${PORT} put {} {}"