|
6 | 6 | #
|
7 | 7 | # Runtime can be up to an hour or more.
|
8 | 8 |
|
9 |
| -echo "Running build.sh..." |
10 |
| -set -x |
11 |
| - |
12 |
| -WHEEL_DIR=/wheelhouse |
13 |
| -VERSIONS="2.6 2.7 3.2 3.3" |
14 |
| -SCRIPT_FILE="/tmp/run.sh" |
15 |
| -PARALLEL=false |
| 9 | +echo "Building wheels..." |
16 | 10 |
|
17 |
| -export PIP_ARGS=" --download-cache /tmp -w $WHEEL_DIR --use-wheel --find-links=$WHEEL_DIR" |
| 11 | +# print a trace for everything; RTFM |
| 12 | +set -x |
18 | 13 |
|
| 14 | +# install and update some basics |
19 | 15 | apt-get update
|
20 | 16 | apt-get install python-software-properties git -y
|
21 | 17 | apt-add-repository ppa:fkrull/deadsnakes -y
|
22 | 18 | apt-get update
|
23 | 19 |
|
| 20 | +# install some deps and virtualenv |
24 | 21 | apt-get install python-pip libfreetype6-dev libpng12-dev -y
|
25 | 22 | pip install virtualenv
|
26 | 23 | apt-get install libhdf5-serial-dev g++ -y
|
| 24 | +apt-get build-dep python-lxml -y |
27 | 25 |
|
| 26 | +export PYTHONIOENCODING='utf-8' |
28 | 27 |
|
29 |
| -function generate_wheels { |
30 |
| - VER=$1 |
31 |
| - set -x |
| 28 | +function generate_wheels() { |
| 29 | + # get the requirements file |
| 30 | + local reqfile="$1" |
32 | 31 |
|
33 |
| - if [ x"$VIRTUAL_ENV" != x"" ]; then |
34 |
| - deactivate |
35 |
| - fi |
| 32 | + # get the python version |
| 33 | + local TAG=$(echo $reqfile | grep -Po "(\d\.?[\d\-](_\w+)?)") |
36 | 34 |
|
37 |
| - cd ~/ |
38 |
| - sudo rm -Rf venv-$VER |
39 |
| - virtualenv -p python$VER venv-$VER |
40 |
| - source venv-$VER/bin/activate |
| 35 | + # base dir for wheel dirs |
| 36 | + local WHEELSTREET=/wheelhouse |
| 37 | + local WHEELHOUSE="$WHEELSTREET/$TAG" |
41 | 38 |
|
42 |
| - pip install -I --download-cache /tmp git+https://github.com/pypa/pip@42102e9d#egg=pip |
43 |
| - pip install -I --download-cache /tmp https://bitbucket.org/pypa/setuptools/downloads/setuptools-0.8b6.tar.gz |
44 |
| - pip install -I --download-cache /tmp wheel |
| 39 | + local PY_VER="${TAG:0:3}" |
| 40 | + local PY_MAJOR="${PY_VER:0:1}" |
| 41 | + local PIP_ARGS="--use-wheel --find-links=$WHEELHOUSE --download-cache /tmp" |
45 | 42 |
|
46 |
| - export INCLUDE_PATH=/usr/include/python$VER/ |
47 |
| - export C_INCLUDE_PATH=/usr/include/python$VER/ |
48 |
| - pip wheel $PIP_ARGS cython==0.19.1 |
49 |
| - pip install --use-wheel --find-links=$WHEEL_DIR cython==0.19.1 |
| 43 | + # install the python version if not installed |
| 44 | + apt-get install python$PY_VER python$PY_VER-dev -y |
50 | 45 |
|
51 |
| - pip wheel $PIP_ARGS numpy==1.6.1 |
52 |
| - pip wheel $PIP_ARGS numpy==1.7.1 |
53 |
| - pip install --use-wheel --find-links=$WHEEL_DIR numpy==1.7.1 |
54 |
| - pip wheel $PIP_ARGS bottleneck==0.6.0 |
| 46 | + # create a new virtualenv |
| 47 | + rm -Rf /tmp/venv |
| 48 | + virtualenv -p python$PY_VER /tmp/venv |
| 49 | + source /tmp/venv/bin/activate |
55 | 50 |
|
56 |
| - pip wheel $PIP_ARGS numexpr==1.4.2 |
57 |
| - pip install --use-wheel --find-links=$WHEEL_DIR numexpr==1.4.2 |
58 |
| - pip wheel $PIP_ARGS tables==2.3.1 |
59 |
| - pip wheel $PIP_ARGS tables==2.4.0 |
| 51 | + # install pip setuptools |
| 52 | + pip install -I --download-cache /tmp 'git+https://github.com/pypa/pip@42102e9d#egg=pip' |
| 53 | + DISTRIBUTE_VERSION= |
| 54 | + if [ "${PY_MAJOR}" == "2" ]; then |
| 55 | + DISTRIBUTE_VERSION="==0.6.35" |
| 56 | + fi |
| 57 | + pip install -I --download-cache /tmp distribute${DISTRIBUTE_VERSION} |
| 58 | + pip install -I --download-cache /tmp wheel |
60 | 59 |
|
61 |
| - pip uninstall numexpr -y |
62 |
| - pip wheel $PIP_ARGS numexpr==2.1 |
63 |
| - pip install --use-wheel --find-links=$WHEEL_DIR numexpr==2.1 |
64 |
| - pip wheel $PIP_ARGS tables==3.0.0 |
65 |
| - pip uninstall numexpr -y |
| 60 | + # make the dir if it doesn't exist |
| 61 | + mkdir -p $WHEELHOUSE |
66 | 62 |
|
67 |
| - pip wheel $PIP_ARGS matplotlib==1.2.1 |
| 63 | + # put the requirements file in the wheelhouse |
| 64 | + cp $reqfile $WHEELHOUSE |
| 65 | + |
| 66 | + # install and build the wheels |
| 67 | + cat $reqfile | while read N; do |
| 68 | + pip wheel $PIP_ARGS --wheel-dir=$WHEELHOUSE $N |
| 69 | + pip install $PIP_ARGS --no-index $N |
| 70 | + done |
68 | 71 | }
|
69 | 72 |
|
70 | 73 |
|
71 |
| -for VER in $VERSIONS ; do |
72 |
| - apt-get install python$VER python$VER-dev -y |
| 74 | +for reqfile in $(ls -1 /reqf/requirements-*.*); do |
| 75 | + generate_wheels "$reqfile" |
73 | 76 | done
|
74 |
| - |
75 |
| -if $PARALLEL; then |
76 |
| - echo '#!/bin/bash' > $SCRIPT_FILE |
77 |
| - echo "export WHEEL_DIR=$WHEEL_DIR" >> $SCRIPT_FILE |
78 |
| - echo "export PIP_ARGS='$PIP_ARGS'">> $SCRIPT_FILE |
79 |
| - |
80 |
| - declare -f generate_wheels >> $SCRIPT_FILE |
81 |
| - echo 'generate_wheels $1' >> $SCRIPT_FILE |
82 |
| - chmod u+x $SCRIPT_FILE |
83 |
| - |
84 |
| - pip install -I --download-cache /tmp git+https://github.com/pypa/pip@42102e9d#egg=pip |
85 |
| - pip install --download-cache /tmp --no-install wheel |
86 |
| - pip install --download-cache /tmp --no-install https://bitbucket.org/pypa/setuptools/downloads/setuptools-0.8b6.tar.gz |
87 |
| - |
88 |
| - for VER in 2.6 2.7 3.2 3.3 ; do |
89 |
| - $SCRIPT_FILE $VER & |
90 |
| - done |
91 |
| - |
92 |
| - wait |
93 |
| - |
94 |
| -else |
95 |
| - for VER in 2.6 2.7 3.2 3.3 ; do |
96 |
| - generate_wheels $VER |
97 |
| - done |
98 |
| -fi |
0 commit comments