From: Cefn Hoile Date: Sun, 25 Feb 2018 00:08:23 +0000 (+0000) Subject: Tested refactored upload scripts for new layout X-Git-Tag: 0.1.0~4^2~28 X-Git-Url: https://git.ayoreis.com/Adafruit_Blinka-hackapet.git/commitdiff_plain/181c0f8a5bc99fe85ab3f27fae85f8d0dfd6161b?ds=sidebyside Tested refactored upload scripts for new layout --- diff --git a/test/scripts/upload_feather_huzzah_circuitpython_put.sh b/test/scripts/upload_feather_huzzah_circuitpython_put.sh index 51134c5..709f1ba 100755 --- a/test/scripts/upload_feather_huzzah_circuitpython_put.sh +++ b/test/scripts/upload_feather_huzzah_circuitpython_put.sh @@ -1,54 +1,38 @@ #!/bin/sh PORT=/dev/ttyUSB0 -# create only relevant directories on the board +export MPYCROSS=`realpath ../../../circuitpython_2.2.3/mpy-cross/mpy-cross` + +# switch to test sources +cd ../src +# create test source directories on board find testing -type d | \ - grep -v -E "(^./.git|^./.idea|^./.vscode|__pycache__)" | \ - grep -v -E '^testing/implementation/micropython*' | \ + grep -v -E "(^./.git.*|^./.idea|^./.vscode|__pycache__)" | \ xargs -n1 -I {} sh -c "echo Creating directory {} ...; ampy --port ${PORT} mkdir --exists-okay {}" - -# put top-level .py modules in place -for NAME in agnostic -do - echo "Copying ${NAME}.py ..." - ampy --port ${PORT} put ${NAME}.py ${NAME}.py -done - -# put top-level .mpy modules in place -for NAME in unittest -do - echo "Copying ${NAME}.mpy ..." - ampy --port ${PORT} put ${NAME}.mpy ${NAME}.mpy -done - -# recursively sync module folders excluding packages -# already provided by circuitpython, and excluding -# testing packages targeting micropython -for NAME in testing +# compile source .py files to .mpy +find . -type f -name '*.py' | \ + xargs -n1 -I {} sh -c "echo compiling {} ...; ${MPYCROSS} {}" +# upload bytecode .mpy files +find . -type f -name '*.mpy' | \ + xargs -n1 -I {} sh -c "echo uploading {} ...; ampy --port ${PORT} put {} {}" + +#switch to test libraries +cd ../libraries/ + +# Compile adafruit libraries to bytecode and upload +for SUBMODULE in `find . -mindepth 1 -maxdepth 1 -type d ` do - find ${NAME} -name '*.py'| \ - grep -v -E '^testing/implementation/micropython*' | \ - grep -v -E '^testing/adafruit_blinka.py' | \ - xargs -n1 -I {} sh -c "echo Copying {} ...; ampy --port ${PORT} put {} {}" -done - -cd ../../ - - - -# I2C dependencies -echo "Copying module adafruit_bus_device..." -cd Adafruit_CircuitPython_BusDevice # change into different repo -ampy --port ${PORT} mkdir --exists-okay adafruit_bus_device -ampy --port ${PORT} put adafruit_bus_device/__init__.py adafruit_bus_device/__init__.py -ampy --port ${PORT} put adafruit_bus_device/i2c_device.py adafruit_bus_device/i2c_device.py -cd ../ - -# Compile BME280 to bytecode -./circuitpython_2.2.3/mpy-cross/mpy-cross Adafruit_CircuitPython_BME280/adafruit_bme280.py - -# BME280 dependencies -echo "Copying module adafruit_bme..." -cd Adafruit_CircuitPython_BME280 # change into different repo -ampy --port ${PORT} put adafruit_bme280.mpy adafruit_bme280.mpy -cd ../ + cd ${SUBMODULE} + # create adafruit library directories on board + find . -mindepth 1 -type d | \ + grep -v -E "(^./.git.*|__pycache__|^./doc.*|^./example.*)" | \ + xargs -n1 -I {} sh -c "echo Creating directory {} ...; ampy --port ${PORT} mkdir --exists-okay {}" + # compile adafruit library .py files to .mpy + find . -type f -name '*.py' | \ + grep -v -E "(^./conf.py|^./docs/conf.py|^./setup.py|^./example.*)" | \ + xargs -n1 -I {} sh -c "echo compiling {} ...; ${MPYCROSS} {}" + # upload adafruit library .mpy files + find . -type f -name '*.mpy' | \ + xargs -n1 -I {} sh -c "echo uploading {} ...; ampy --port ${PORT} put {} {}" + cd ../ +done \ No newline at end of file diff --git a/test/scripts/upload_feather_huzzah_micropython_put.sh b/test/scripts/upload_feather_huzzah_micropython_put.sh index 903ea7a..38ed597 100755 --- a/test/scripts/upload_feather_huzzah_micropython_put.sh +++ b/test/scripts/upload_feather_huzzah_micropython_put.sh @@ -1,52 +1,51 @@ #!/bin/sh PORT=/dev/ttyUSB0 -# needs a git repo with micropython sharing a top-level directory -# where make has been run in the mpy-cross directory - -# Compile unittest to bytecode -../../micropython/mpy-cross/mpy-cross unittest.py - -# filter directories, and create relevant ones on the board -find . -type d -mindepth 1 | \ - grep -v -E "(^./.git|^./.idea|^./.vscode|__pycache__)" | \ - xargs -n1 -I {} sh -c "echo Creating directory {} ...; ampy --port ${PORT} mkdir --exists-okay {}" - -# put top-level .py modules in place -for NAME in agnostic -do - echo "Copying ${NAME}.py ..." - ampy --port ${PORT} put ${NAME}.py ${NAME}.py -done - -# put top-level .mpy modules in place -for NAME in unittest +export MPYCROSS=`realpath ../../../micropython/mpy-cross/mpy-cross` + +# switch to test sources +cd ../src +# create test source directories on board +find testing -type d | \ + grep -v -E "(^./.git.*|^./.idea|^./.vscode|__pycache__)" | \ + xargs -n1 -I {} sh -c "echo Creating directory {} ...; ampy --port ${PORT} mkdir --exists-okay {}" +# compile source .py files to .mpy +find . -type f -name '*.py' | \ + xargs -n1 -I {} sh -c "echo compiling {} ...; ${MPYCROSS} {}" +# upload bytecode .mpy files +find . -type f -name '*.mpy' | \ + xargs -n1 -I {} sh -c "echo uploading {} ...; ampy --port ${PORT} put {} {}" + +#switch to test libraries +cd ../libraries/ + +# Compile adafruit libraries to bytecode and upload +for SUBMODULE in `find . -mindepth 1 -maxdepth 1 -type d ` do - echo "Copying ${NAME}.mpy ..." - ampy --port ${PORT} put ${NAME}.mpy ${NAME}.mpy + cd ${SUBMODULE} + # create adafruit library directories on board + find . -mindepth 1 -type d | \ + grep -v -E "(^./.git.*|__pycache__|^./doc.*|^./example.*)" | \ + xargs -n1 -I {} sh -c "echo Creating directory {} ...; ampy --port ${PORT} mkdir --exists-okay {}" + # compile adafruit library .py files to .mpy + find . -type f -name '*.py' | \ + grep -v -E "(^./conf.py|^./docs/conf.py|^./setup.py|^./example.*)" | \ + xargs -n1 -I {} sh -c "echo compiling {} ...; ${MPYCROSS} {}" + # upload adafruit library .mpy files + find . -type f -name '*.mpy' | \ + xargs -n1 -I {} sh -c "echo uploading {} ...; ampy --port ${PORT} put {} {}" + cd ../ done -# recursively sync folders of nested packages -for NAME in board digitalio mcp microcontroller testing -do - find ${NAME} -name '*.py'| xargs -n1 -I {} sh -c "echo Copying {} ...; ampy --port ${PORT} put {} {}" -done - -cd ../../ # change into folder containing repo - -# I2C dependencies -echo "Copying module adafruit_bus_device..." -cd Adafruit_CircuitPython_BusDevice # change into different repo -ampy --port ${PORT} mkdir --exists-okay adafruit_bus_device -ampy --port ${PORT} put adafruit_bus_device/__init__.py adafruit_bus_device/__init__.py -ampy --port ${PORT} put adafruit_bus_device/i2c_device.py adafruit_bus_device/i2c_device.py -cd ../ - -# Compile BME280 to bytecode -./micropython/mpy-cross/mpy-cross ./Adafruit_CircuitPython_BME280/adafruit_bme280.py - -# BME280 dependencies -echo "Copying module adafruit_bme..." -cd Adafruit_CircuitPython_BME280 # change into different repo -ampy --port ${PORT} put adafruit_bme280.mpy adafruit_bme280.mpy -cd ../ +# switch to adafruit_blinka source +cd ../../src + +find . -mindepth 1 -type d | \ + grep -v -E "(^./.git.*|__pycache__)" | \ + xargs -n1 -I {} sh -c "echo Creating directory {} ...; ampy --port ${PORT} mkdir --exists-okay {}" +# compile adafruit blinka .py files to .mpy +find . -type f -name '*.py' | \ + xargs -n1 -I {} sh -c "echo compiling {} ...; ${MPYCROSS} {}" +# upload adafruit blinka .mpy files +find . -type f -name '*.mpy' | \ + xargs -n1 -I {} sh -c "echo uploading {} ...; ampy --port ${PORT} put {} {}" \ No newline at end of file