-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathcreate_wheels.sh
More file actions
executable file
·63 lines (54 loc) · 1.94 KB
/
create_wheels.sh
File metadata and controls
executable file
·63 lines (54 loc) · 1.94 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
#!/bin/bash
set -e;
SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)";
###########################################
## THIS CODE IS EXECUTED WITHIN THE HOST ##
###########################################
if [ ! -f /.dockerenv ]; then
docker run --rm --log-driver none \
-v /tmp:/host/tmp \
-v ${SOURCE_DIR}:/host/src \
joapuipe/manylinux-centos7 \
/host/src/create_wheels.sh;
exit 0;
fi;
#######################################################
## THIS CODE IS EXECUTED WITHIN THE DOCKER CONTAINER ##
#######################################################
set -ex;
yum install -y centos-release-scl;
yum install -y devtoolset-6-gcc*;
source /opt/rh/devtoolset-6/enable;
# Copy host source directory, to avoid changes in the host.
cp -r /host/src /tmp/src;
rm -rf /tmp/src/build /tmp/src/dist;
# This is required to build OpenFst.
yum install -y zlib-devel;
for py in cp27-cp27mu cp35-cp35m cp36-cp36m cp37-cp37m; do
cd /tmp/src;
export PYTHON=/opt/python/$py/bin/python;
echo "=== Installing dependencies for $py ===";
$PYTHON -m pip install -U pip;
$PYTHON -m pip install -U requests wheel setuptools;
echo "=== Building for $py ==="
$PYTHON setup.py clean;
$PYTHON setup.py bdist_wheel;
echo "=== Installing for $py ===";
cd /tmp;
$PYTHON -m pip uninstall -y openfst_python;
$PYTHON -m pip install openfst_python --no-index -f /tmp/src/dist --no-dependencies -v;
echo "=== Testing for $py ===";
$PYTHON -m unittest openfst_python.test;
done;
set +x;
ODIR="/host/tmp/openfst_python/whl";
mkdir -p "$ODIR";
readarray -t wheels < <(find /tmp/src/dist -name "*.whl");
for whl in "${wheels[@]}"; do
whl_name="$(basename "$whl")";
whl_name="${whl_name/-linux/-manylinux1}";
cp "$whl" "${ODIR}/${whl_name}";
done;
echo "================================================================";
printf "=== %-56s ===\n" "Copied ${#wheels[@]} wheels to ${ODIR:5}";
echo "================================================================";