Skip to content

Commit 0ff2235

Browse files
committed
Simplify linux wheel builds, add OSX wheel builds
1 parent 9268398 commit 0ff2235

2 files changed

Lines changed: 62 additions & 38 deletions

File tree

.travis.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
notifications:
22
email: false
33

4+
os:
5+
- linux
6+
- osx
7+
48
matrix:
59
include:
6-
- sudo: required
10+
- os: osx
11+
- os: linux
12+
sudo: required
713
services:
814
- docker
915
env: DOCKER_IMAGE=quay.io/pypa/manylinux1_x86_64
@@ -15,11 +21,12 @@ matrix:
1521
# PRE_CMD=linux32
1622

1723
install:
18-
- sudo pip install appveyor-artifacts
19-
- docker pull $DOCKER_IMAGE
24+
- if [[ "$TRAVIS_OS_NAME" == "linux"]]; then sudo pip install appveyor-artifacts; fi
25+
- if [[ "$TRAVIS_OS_NAME" == "linux"]]; then docker pull $DOCKER_IMAGE; fi
2026

2127
script:
22-
- docker run --rm -v `pwd`:/io $DOCKER_IMAGE $PRE_CMD /io/build-wheels.sh
28+
- if [[ "$TRAVIS_OS_NAME" == "osx"]]; then ./build-wheels $TRAVIS_OS_NAME; fi
29+
- if [[ "$TRAVIS_OS_NAME" == "linux"]]; then docker run --rm -v `pwd`:/io $DOCKER_IMAGE $PRE_CMD /io/build-wheels.sh $TRAVIS_OS_NAME; fi
2330
- ls wheelhouse/
2431

2532
after_success:

build-wheels.sh

Lines changed: 51 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -54,44 +54,61 @@ OPENSSL_VERSION=1.0.2h
5454
CURL_VERSION=7.49.0
5555
RUST_CHANNEL=nightly
5656

57-
# Clean build files
58-
clean_project
57+
# It doesn't matter with which Python version we build the wheel, so we
58+
# use the oldest supported one
59+
if [[ $1 == "osx" ]]; then
60+
brew update
61+
brew install python2.7 mmv
62+
install_rust $RUST_CHANNEL
63+
pip wheel /io/ -w /io/wheelhouse
64+
mmv "/io/wheelhouse/rust_fst-*-cp*-none-macosx*.whl" \
65+
"/io/wheelhouse/rust_fst-#1-py2.py3-none-macosx#3.whl"
66+
pip install -v rust_fst --no-index -f /io/wheelhouse
67+
pip install pytest
68+
cd /
69+
py.test /io/tests
70+
else
71+
PYBIN=/opt/python/cp27-cp27m/bin
72+
# Clean build files
73+
clean_project
5974

60-
install_openssl $OPENSSL_VERSION
61-
install_curl $CURL_VERSION
62-
install_rust $RUST_CHANNEL
75+
install_openssl $OPENSSL_VERSION
76+
install_curl $CURL_VERSION
77+
install_rust $RUST_CHANNEL
6378

64-
# Remove old wheels
65-
rm -rf /io/wheelhouse/* || echo "No old wheels to delete"
79+
# Remove old wheels
80+
rm -rf /io/wheelhouse/* || echo "No old wheels to delete"
6681

67-
# We don't support Python 2.6
68-
rm -rf /opt/python/cp26*
82+
# We don't support Python 2.6
83+
rm -rf /opt/python/cp26*
6984

70-
# Install libraries needed for compiling the extension
71-
yum -q -y install libffi-devel
85+
# Install libraries needed for compiling the extension
86+
yum -q -y install libffi-devel mmv
7287

73-
# Compile wheels
74-
for PYBIN in /opt/python/*/bin; do
88+
# Compile wheel
7589
${PYBIN}/python -m pip wheel /io/ -w /wheelhouse/
76-
clean_project
77-
done
78-
79-
# Move pure wheels to output wheelhouse
80-
mkdir -p /io/wheelhouse/
81-
mv /wheelhouse/*any.whl /io/wheelhouse/ || echo "No pure wheels found."
8290

83-
# Bundle external shared libraries into the wheels
84-
for whl in /wheelhouse/*.whl; do
85-
auditwheel repair $whl -w /io/wheelhouse/
86-
done
87-
88-
# Set permissions on wheels
89-
chmod -R a+rw /io/wheelhouse
90-
91-
# Install packages and test
92-
for PYBIN in /opt/python/*/bin/; do
93-
${PYBIN}/python -m pip install pytest
94-
${PYBIN}/python -m pip install rust_fst --no-index -f /io/wheelhouse
95-
${PYBIN}/python -m pytest --verbose /io/tests
96-
clean_project
97-
done
91+
# Move pure wheels to target directory
92+
mv /wheelhouse/*any.whl /io/wheelhouse || echo "No pure wheels to move"
93+
94+
# Bundle external shared libraries into the wheel
95+
for whl in /wheelhouse/*.whl; do
96+
cp $whl /io/wheelhouse/
97+
auditwheel repair $whl -w /io/wheelhouse/
98+
done
99+
100+
# Rename wheels to match all Python versions
101+
mmv "/io/wheelhouse/rust_fst-*-cp*-cp*-manylinux1_*.whl" \
102+
"/io/wheelhouse/rust_fst-#1-py2.py3-none-manylinux1_#4.whl"
103+
104+
# Set permissions on wheels
105+
chmod -R a+rw /io/wheelhouse
106+
107+
# Install packages and test with all Python versions
108+
for PYBIN in /opt/python/*/bin/; do
109+
${PYBIN}/python -m pip install pytest cffi
110+
${PYBIN}/python -m pip install rust_fst --no-index -f /io/wheelhouse
111+
${PYBIN}/python -m pytest --verbose /io/tests
112+
clean_project
113+
done
114+
fi

0 commit comments

Comments
 (0)