-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathmake_zip.sh
More file actions
executable file
·135 lines (118 loc) · 3.99 KB
/
make_zip.sh
File metadata and controls
executable file
·135 lines (118 loc) · 3.99 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/bash
# Create zipfile for the MicroPython IoT Hackathon
# This is current as of 8/2017.
CURRENT_PATH=$(pwd)
if [ ! -f docs/conf.py ]; then
echo "Could not find Sphinx configuration file at ./docs/conf.py"
exit 1
fi
RELEASE=`cd docs; python3 -c "import conf; print(conf.release)"`
echo "RELEASE is $RELEASE"
TMP_PATH=$(mktemp -d)
trap "rm -rf $TMP_PATH" EXIT # Ensure temporary path gets removed on exit
cd $TMP_PATH
#Find pip
PIP36=`which pip3.6`
PIP3=`which pip3`
PIPBARE=`which pip`
if [[ "$PIP36" != "" ]]; then
PIP=$PIP36
elif [[ "$PIP3" != "" ]]; then
PIP=$PIP3
elif [[ "$PIPBARE" != "" ]]; then
PIP=$PIPBARE
else
echo "Could not find pip3.6, pip3, or pip"
exit 1
fi
echo "Using $PIP as pip program"
if [[ `which wget` == "" ]]; then
echo "Could not find wget"
exit 1
fi
set -e # Stop if there is any error
# create root dir
mkdir micropython-iot-software
# Get tool wheels
$PIP wheel -w micropython-iot-software/python-tools --no-binary=:all: esptool adafruit-ampy \
wheel paho_mqtt thingflow git+https://github.com/wendlers/mpfshell
# Get firmware
cd micropython-iot-software
BASE=`pwd` # save for later
wget http://micropython.org/resources/firmware/esp8266-20170612-v1.9.1.bin
# Get repos
git clone https://github.com/mpi-sws-rse/thingflow-python
rm -rf thingflow-python/.git
git clone https://github.com/jfischer/micropython-iot-hackathon
mv micropython-iot-hackathon/example_code ./example_code
# build the docs
echo "building docs"
pip install sphinx_rtd_theme # theme for docs
mkdir docs
mv micropython-iot-hackathon/lecture.pdf ./docs
cd micropython-iot-hackathon/docs
make html
mv _build/html $BASE/docs/micropython-iot-hackathon
cd $BASE
rm -rf micropython-iot-hackathon # no longer need the original code
cd thingflow-python/docs
make html
mv _build/html $BASE/docs/thingflow-python
rm -rf _build
cd $BASE
# clone and build micropython docs
mkdir $BASE/mpbuild
cd $BASE/mpbuild
git clone https://github.com/micropython/micropython.git
cd micropython
git checkout -b v1.9.1
cd docs
make MICROPY_PORT=esp8266 html
cd build/esp8266
mv html $BASE/docs/micropython
cd $BASE
rm -rf ./mpbuild
# Download terminal programs
mkdir terminal; cd terminal
wget https://the.earth.li/~sgtatham/putty/latest/w32/putty-0.70-installer.msi
wget ftp.us.debian.org/debian/pool/main/s/screen/screen_4.5.0-6_amd64.deb
cd ..
# Download drivers
mkdir drivers; cd drivers
wget https://www.silabs.com/documents/public/software/CP210x_Windows_Drivers.zip
wget https://www.silabs.com/documents/public/software/Mac_OSX_VCP_Driver.zip
cd ..
# Prepare esp8266 modules to upload
mkdir micropython; cd micropython
cp $BASE/example_code/client.py .
cp ../thingflow-python/micropython/*.py .
cp ../thingflow-python/micropython/sensors/*.py .
cd $BASE
echo "Generating README.txt..."
echo "MicroPython IoT Hackathon Downloads Archive" >README.txt
echo "===========================================" >>README.txt
echo "Generated from version $RELEASE on `date`" >>README.txt
echo "To get started, see docs/micropython-iot-hackathon/index.html" >>README.txt
echo >>README.txt
echo "File Layout" >>README.txt
echo "-----------" >>README.txt
echo "docs/" >>README.txt
echo " micropython-iot-hackathon/" >>README.txt
echo " micropython/" >> README.txt
echo " thingflow-python/" >>README.txt
echo "drivers/ (serial drivers for MacOS and Windows)" >>README.txt
echo "esp8266-20170612-v1.9.1.bin (MicroPython firmware image)" >>README.txt
echo "example_code/ (from micropython-iot-hackathon repo)" >>README.txt
echo "micropython/ (ThingFlow and other code for ESP8266)" >>README.txt
echo "python-tools/ (Python libraries for your laptop)" >>README.txt
echo "terminal/ (PuTTY for Windows, screen for Linux)" >>README.txt
echo "thingflow-python/ (ThingFlow source and example code)" >>README.txt
echo >>README.txt
echo "Have fun!" >>README.txt
cd ..
# Create a zip file
zip -r micropython-iot-software.zip micropython-iot-software
# Cleanup
cd $CURRENT_PATH
mv $TMP_PATH/micropython-iot-software.zip .
echo "Successfully created micropython-iot-software.zip"