Skip to content

Commit 1b173c5

Browse files
committed
Simplify windows wheel builds
1 parent 0ff2235 commit 1b173c5

File tree

3 files changed

+38
-43
lines changed

3 files changed

+38
-43
lines changed

.travis.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
notifications:
22
email: false
33

4-
os:
5-
- linux
6-
- osx
7-
84
matrix:
95
include:
106
- os: osx
@@ -21,19 +17,17 @@ matrix:
2117
# PRE_CMD=linux32
2218

2319
install:
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
20+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo pip install appveyor-artifacts; fi
21+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull $DOCKER_IMAGE; fi
2622

2723
script:
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
24+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./build-wheels.sh $TRAVIS_OS_NAME; fi
25+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run --rm -v `pwd`:/io $DOCKER_IMAGE $PRE_CMD /io/build-wheels.sh $TRAVIS_OS_NAME; fi
3026
- ls wheelhouse/
3127

3228
after_success:
33-
- appveyor-artifacts -c $(git rev-parse HEAD) -o jbaiter -n python-rust-fst download
34-
- mkdir -p dist
35-
- mv wheelhouse/* dist
36-
- ls dist
29+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then appveyor-artifacts -c $(git rev-parse HEAD) -o jbaiter -n python-rust-fst download; fi
30+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mkdir -p dist; mv wheelhouse/* dist; ls dist; fi
3731

3832
deploy:
3933
- provider: releases

appveyor.yml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
11
environment:
22
matrix:
3-
- PYTHON: "C:\\Python27"
3+
- PYARCH: ""
44
RUST_TARGET: "i686-pc-windows-msvc"
5-
- PYTHON: "C:\\Python33"
6-
RUST_TARGET: "i686-pc-windows-msvc"
7-
- PYTHON: "C:\\Python34"
8-
RUST_TARGET: "i686-pc-windows-msvc"
9-
- PYTHON: "C:\\Python35"
10-
RUST_TARGET: "i686-pc-windows-msvc"
11-
- PYTHON: "C:\\Python27-x64"
12-
RUST_TARGET: "x86_64-pc-windows-msvc"
13-
- PYTHON: "C:\\Python33-x64"
14-
DISTUTILS_USE_SDK: "1"
15-
RUST_TARGET: "x86_64-pc-windows-msvc"
16-
- PYTHON: "C:\\Python34-x64"
17-
DISTUTILS_USE_SDK: "1"
18-
RUST_TARGET: "x86_64-pc-windows-msvc"
19-
- PYTHON: "C:\\Python35-x64"
5+
- PYARCH: "-x64"
206
RUST_TARGET: "x86_64-pc-windows-msvc"
217

228
install:
9+
- SET PYTHON=C:\Python27%PYARCH%
2310
- "%PYTHON%\\python -m pip install -U pip setuptools wheel"
2411
- ps: Start-FileDownload "https://static.rust-lang.org/dist/rust-nightly-${env:RUST_TARGET}.exe"
2512
- rust-nightly-%RUST_TARGET%.exe /VERYSILENT /NORESTART /DIR="C:\Program Files (x86)\Rust"
2613
- SET PATH=%PATH%;C:\Program Files (x86)\Rust\bin
2714
- SET PATH=%PATH%;C:\MinGW\bin
2815

2916
build_script:
30-
- ".build.cmd %PYTHON%\\python -m pip install cffi pytest"
31-
# We build the shared library outside of setuptools since we run into problems
32-
# with the %PATH% set by .build.cmd...
33-
- "cargo build --manifest-path fstwrapper/Cargo.toml --release"
34-
- ".build.cmd %PYTHON%\\python -m pip -v wheel . -w .\\wheelhouse"
17+
- "%PYTHON%\\python -m pip install pytest"
18+
- "%PYTHON%\\python -m pip -v wheel . -w .\\wheelhouse"
19+
# Rename the wheel so it is valid for all Python versions
20+
# This is possible since our shared library does not link against any
21+
# Python ABI
22+
# TODO: This leaves the old Python ABI/ABI tags in the 'WHEEL' file inside
23+
# of the wheel. However, `pip` does not seem to validate against that
24+
# currently, so we're safe until they change it...
25+
- ps: |
26+
get-childItem wheelhouse\*-cp*-win*.whl | rename-item -newname {
27+
$_.name -replace '-cp.*?-cp.*?-','-py2.py3-none-'
28+
}
3529
- dir wheelhouse
3630

3731
test_script:
3832
- SET PROJPATH=C:\Projects\python-rust-fst
3933
- cd c:\projects
40-
- "%PYTHON%\\python -m pip -v install rust_fst --no-index -f %PROJPATH%\\wheelhouse"
41-
- "%PYTHON%\\python -m pytest --verbose %PROJPATH%\\tests"
34+
- ps: |
35+
$PyVersions = @("27", "33", "34", "35")
36+
foreach ($pyver in $PyVersions) {
37+
$python = "C:\\Python$pyver${env:PYARCH}\\python"
38+
&$python -m pip install -U pip setuptools wheel pytest cffi
39+
&$python -m pip -v install rust_fst --no-index -f "${env:PROJPATH}\wheelhouse"
40+
&$python -m pytest "${env:PROJPATH}\tests"
41+
}
4242
4343
artifacts:
4444
- path: wheelhouse\rust_fst*.whl

build-wheels.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,16 @@ RUST_CHANNEL=nightly
5858
# use the oldest supported one
5959
if [[ $1 == "osx" ]]; then
6060
brew update
61-
brew install python2.7 mmv
61+
brew install python mmv
62+
pip install -U pip setuptools wheel
6263
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
64+
pip wheel . -w ./wheelhouse
65+
mmv "./wheelhouse/rust_fst-*-cp*-cp*-macosx*.whl" \
66+
"./wheelhouse/rust_fst-#1-py2.py3-none-macosx#4.whl"
67+
pip install -v rust_fst --no-index -f ./wheelhouse
6768
pip install pytest
68-
cd /
69-
py.test /io/tests
69+
cd ../
70+
py.test ./python-rust-fst/tests
7071
else
7172
PYBIN=/opt/python/cp27-cp27m/bin
7273
# Clean build files
@@ -89,11 +90,11 @@ else
8990
${PYBIN}/python -m pip wheel /io/ -w /wheelhouse/
9091

9192
# Move pure wheels to target directory
93+
mkdir -p /io/wheelhouse
9294
mv /wheelhouse/*any.whl /io/wheelhouse || echo "No pure wheels to move"
9395

9496
# Bundle external shared libraries into the wheel
9597
for whl in /wheelhouse/*.whl; do
96-
cp $whl /io/wheelhouse/
9798
auditwheel repair $whl -w /io/wheelhouse/
9899
done
99100

0 commit comments

Comments
 (0)