-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
/
Copy pathbuild.sh
executable file
·76 lines (58 loc) · 2.03 KB
/
build.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
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
#!/bin/bash
# This script is meant to run on a mint precise64 VM.
# The generated wheel files should be compatible
# with travis-ci as of 07/2013.
#
# Runtime can be up to an hour or more.
echo "Building wheels..."
# print a trace for everything; RTFM
set -x
# install and update some basics
apt-get update
apt-get install python-software-properties git -y
apt-add-repository ppa:fkrull/deadsnakes -y
apt-get update
# install some deps and virtualenv
apt-get install python-pip libfreetype6-dev libpng12-dev -y
pip install virtualenv
apt-get install libhdf5-serial-dev g++ -y
apt-get build-dep python-lxml -y
export PYTHONIOENCODING='utf-8'
function generate_wheels() {
# get the requirements file
local reqfile="$1"
# get the python version
local TAG=$(echo $reqfile | grep -Po "(\d\.?[\d\-](_\w+)?)")
# base dir for wheel dirs
local WHEELSTREET=/wheelhouse
local WHEELHOUSE="$WHEELSTREET/$TAG"
local PY_VER="${TAG:0:3}"
local PY_MAJOR="${PY_VER:0:1}"
local PIP_ARGS="--use-wheel --find-links=$WHEELHOUSE --download-cache /tmp"
# install the python version if not installed
apt-get install python$PY_VER python$PY_VER-dev -y
# create a new virtualenv
rm -Rf /tmp/venv
virtualenv -p python$PY_VER /tmp/venv
source /tmp/venv/bin/activate
# install pip setuptools
pip install -I --download-cache /tmp 'git+https://github.com/pypa/pip@42102e9d#egg=pip'
DISTRIBUTE_VERSION=
if [ "${PY_MAJOR}" == "2" ]; then
DISTRIBUTE_VERSION="==0.6.35"
fi
pip install -I --download-cache /tmp distribute${DISTRIBUTE_VERSION}
pip install -I --download-cache /tmp wheel
# make the dir if it doesn't exist
mkdir -p $WHEELHOUSE
# put the requirements file in the wheelhouse
cp $reqfile $WHEELHOUSE
# install and build the wheels
cat $reqfile | while read N; do
pip wheel $PIP_ARGS --wheel-dir=$WHEELHOUSE $N
pip install $PIP_ARGS --no-index $N
done
}
for reqfile in $(ls -1 /reqf/requirements-*.*); do
generate_wheels "$reqfile"
done