]> Repositories - Adafruit_Blinka-hackapet.git/blob - test/scripts/upload_pyboard_micropython_cp.sh
Merge pull request #993 from avenstewart/add-orange-pi-5-pro
[Adafruit_Blinka-hackapet.git] / test / scripts / upload_pyboard_micropython_cp.sh
1 #!/bin/sh
2 # SPDX-FileCopyrightText: 2021 Melissa LeBlanc-Williams for Adafruit Industries
3 #
4 # SPDX-License-Identifier: MIT
5
6 export PORT="/dev/ttyUSB0"
7 export MPYCROSS=`realpath ../../../micropython/mpy-cross/mpy-cross`
8 export COPY="cp --parents "
9 export ROOT="/media/cefn/PYBFLASH/"
10
11
12 # switch to test sources
13 cd ../src
14 # compile source .py files to .mpy
15 find . -type f -name '*.py' | \
16     xargs -n1 -I {} sh -c "echo compiling {} ...; ${MPYCROSS} {}"
17 # upload bytecode .mpy files
18 find ./ -type f -name '*.mpy' | \
19         sed "s|^\./||" | \
20         xargs -n1 -I {} sh -c "echo uploading {} ...; ${COPY} {} ${ROOT}"
21
22 #switch to test libraries
23 cd ../libraries/
24
25 # Compile adafruit libraries to bytecode and upload
26 for SUBMODULE in gps # `find . -mindepth 1 -maxdepth 1 -type d `
27 do
28     cd ${SUBMODULE}
29     # compile adafruit library .py files to .mpy
30     find . -type f -name '*.py' | \
31         grep -v -E "(^./conf.py|^./docs/conf.py|^./setup.py|^./example.*)" | \
32         xargs -n1 -I {} sh -c "echo compiling {} ...; ${MPYCROSS} {}"
33     # upload adafruit library .mpy files
34     find ./ -type f -name '*.mpy' | \
35             sed "s|^\./||" | \
36             xargs -n1 -I {} sh -c "echo uploading {} ...; ${COPY} {} ${ROOT}"
37     cd ../
38 done
39
40 # switch to adafruit_blinka source
41 cd ../../src
42
43 # compile adafruit blinka .py files to .mpy
44 find . -type f -name '*.py' | \
45     xargs -n1 -I {} sh -c "echo compiling {} ...; ${MPYCROSS} {}"
46 # upload adafruit blinka .mpy files
47 find ./ -type f -name '*.mpy' | \
48         sed "s|^\./||" | \
49         xargs -n1 -I {} sh -c "echo uploading {} ...; ${COPY} {} ${ROOT}"