]> Repositories - Adafruit_Blinka-hackapet.git/commitdiff
File upload routine to complement https://github.com/ShrimpingIt/cockle/blob/1d593448...
authorCefn Hoile <github.com@cefn.com>
Sat, 17 Feb 2018 01:08:01 +0000 (01:08 +0000)
committerCefn Hoile <github.com@cefn.com>
Sat, 17 Feb 2018 01:08:01 +0000 (01:08 +0000)
python/put.sh [new file with mode: 0755]

diff --git a/python/put.sh b/python/put.sh
new file mode 100755 (executable)
index 0000000..3a6cb0e
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+PORT=/dev/ttyUSB0
+
+# filter directories, and create relevant ones on the board
+find . -mindepth 1 -type d | grep -v -E "(.(git|idea|vscode)|__pycache__)" | xargs -n1 ampy --port ${PORT} mkdir
+
+# put top-level modules in place
+for NAME in agnostic unittest
+do
+    echo "Copying ${NAME}.py ..."
+    ampy --port ${PORT} put ${NAME}.py ${NAME}.py
+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