]> Repositories - Adafruit_Blinka-hackapet.git/blob - python/upload_feather_huzzah_micropython_put.sh
Packages reverted to modules
[Adafruit_Blinka-hackapet.git] / python / upload_feather_huzzah_micropython_put.sh
1 #!/bin/sh
2 PORT=/dev/ttyUSB0
3
4 # needs a git repo with micropython sharing a top-level directory
5 # where make has been run in the mpy-cross directory
6
7 # Compile unittest to bytecode
8 ../../micropython/mpy-cross/mpy-cross unittest.py
9
10 # filter directories, and create relevant ones on the board
11 find . -type d -mindepth 1 | \
12         grep -v -E "(^./.git|^./.idea|^./.vscode|__pycache__)" | \
13         xargs -n1 -I {} sh -c "echo Creating directory {} ...; ampy --port ${PORT} mkdir --exists-okay {}"
14
15 # put top-level .py modules in place
16 for NAME in agnostic
17 do
18     echo "Copying ${NAME}.py ..."
19     ampy --port ${PORT} put ${NAME}.py ${NAME}.py
20 done
21
22 # put top-level .mpy modules in place
23 for NAME in unittest
24 do
25     echo "Copying ${NAME}.mpy ..."
26     ampy --port ${PORT} put ${NAME}.mpy ${NAME}.mpy
27 done
28
29 # recursively sync folders of nested packages
30 for NAME in board digitalio mcp microcontroller testing
31 do
32     find ${NAME} -name '*.py'| xargs -n1 -I {} sh -c "echo Copying {} ...; ampy --port ${PORT} put {} {}"
33 done
34
35 cd ../../ # change into folder containing repo
36
37 # I2C dependencies
38 echo "Copying module adafruit_bus_device..."
39 cd Adafruit_CircuitPython_BusDevice # change into different repo
40 ampy --port ${PORT} mkdir --exists-okay adafruit_bus_device
41 ampy --port ${PORT} put adafruit_bus_device/__init__.py adafruit_bus_device/__init__.py
42 ampy --port ${PORT} put adafruit_bus_device/i2c_device.py adafruit_bus_device/i2c_device.py
43 cd ../
44
45 # Compile BME280 to bytecode
46 ./micropython/mpy-cross/mpy-cross ./Adafruit_CircuitPython_BME280/adafruit_bme280.py
47
48 # BME280 dependencies
49 echo "Copying module adafruit_bme..."
50 cd Adafruit_CircuitPython_BME280 # change into different repo
51 ampy --port ${PORT} put adafruit_bme280.mpy adafruit_bme280.mpy
52 cd ../