-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bakefile
51 lines (42 loc) · 1.13 KB
/
Bakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
OUTPUT_DIR=out
microbit="/media/${USER}/MICROBIT/"
minify:
if [ ! -d $OUTPUT_DIR ]; then
mkdir $OUTPUT_DIR
echo "$OUTPUT_DIR dir created"
fi
pyminifier -o "${OUTPUT_DIR}/$1" $1
upload:
if [ ! -d $microbit ]; then
echo "$microbit not exists. micro:bit device is probably not connected"
else
for file in "$@"; do
echo "uploading $file"
bake minify $file
base_name="$(basename $file)"
ufs put "$OUTPUT_DIR/$base_name"
done
fi
compile: minify
py2hex "${OUTPUT_DIR}/$1"
flash: compile
if [ ! -d $microbit ]; then
echo "$microbit not exists. micro:bit device is probably not connected"
else
hexfile="${1/.py/.hex}"
cp "${OUTPUT_DIR}/$hexfile" $microbit
fi
flash_fast:
if [ ! -d $microbit ]; then
echo "$microbit not exists. micro:bit device is probably not connected"
else
uflash $1
fi
flash_clean:
if [ ! -d $microbit ]; then
echo "$microbit not exists. micro:bit device is probably not connected"
else
uflash
fi
clean:
rm -rf $OUTPUT_DIR