File tree Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Expand file tree Collapse file tree 1 file changed +24
-3
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
+ shopt -s expand_aliases
4
+
5
+ # TODO: uh, fix this
6
+ alias mpy_cross=" /Users/tommy/circuitpython/mpy-cross/mpy-cross"
7
+
3
8
{
4
9
5
10
function help() {
@@ -25,11 +30,27 @@ device="/Volumes/CIRCUITPY"
25
30
subject=" main.py" # TODO: parameterize
26
31
27
32
function deploy() {
28
- echo " SYNCING"
33
+ rm -rf " _build/"
34
+
35
+ # Compile .py files to .mpy and move to _build
36
+ for file in lib/* .py lib/** /* .py; do
37
+ path_without_extension=$( echo " $file " | cut -f 1 -d ' .' )
38
+ mpy_path=" $path_without_extension .mpy"
39
+ echo " $file -> $mpy_path "
40
+ mpy_cross $file
41
+ mkdir -p " $( dirname " _build/$file " ) "
42
+ mv -f -v " $mpy_path " " _build/$mpy_path "
43
+ done
44
+
45
+ # Copy subject and any remaining .mpy files to _build
46
+ for file in " $subject " lib/* .mpy lib/** /* .mpy; do
47
+ cp -v " $file " " _build/$file "
48
+ done
49
+
29
50
rsync \
30
51
--archive --verbose --compress \
31
- " $subject " \
32
- /Volumes/CIRCUITPY/
52
+ " _build/ " \
53
+ " $device "
33
54
}
34
55
35
56
function watch() {
You can’t perform that action at this time.
0 commit comments