-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_addon.sh
executable file
·44 lines (36 loc) · 992 Bytes
/
build_addon.sh
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
#!/bin/bash
PYENV_PACKAGES="pyenv/lib/python2.7/site-packages"
# Interrupt script on any error
set -e
# Cleanup
rm -rf build
rm -rf pyenv
rm -rf dist
mkdir build
mkdir dist
# Create PIP env with dependencies
if [ ! -d pyenv ]; then
virtualenv -p python2 pyenv
fi
. pyenv/bin/activate
# This is needed, otherwise pip install will throw an error:
# ImportError: No module named _markerlib
easy_install distribute
pip install -r vpower/requirements.txt
# Copy dependencies
cp -rv addon/* build/
cp -rv "$PYENV_PACKAGES/ant" build/
cp -rv "$PYENV_PACKAGES/msgpack" build/
cp -rv "$PYENV_PACKAGES/serial" build/
cp -rv "$PYENV_PACKAGES/usb" build/
cp -rv "vpower" build/
# Allow vpower to be used as module
touch "build/vpower/__init__.py"
rm -rv "build/vpower/.git" "build/vpower/.gitignore"
# Patch ANT+
patch -p0 < ant_driver.patch
# Patch Vpower config
patch -p0 < vpower_config.patch
# Create addon zip
# find build/ -iname "*.pyc" -exec rm -v {} \;
zip -r dist/vpower.zip build/*