Skip to content

Commit 22981b3

Browse files
committed
Use cibuildwheel to build wheels.
1 parent 891ce5d commit 22981b3

File tree

5 files changed

+36
-237
lines changed

5 files changed

+36
-237
lines changed

.github/workflows/ci.yml

+35-13
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,40 @@
1-
on:
2-
release:
3-
branches: [master]
4-
types: [created]
51
env:
6-
TWINE_USERNAME: ${{secrets.TWINE_USERNAME}}
7-
TWINE_PASSWORD: ${{secrets.TWINE_PASSWORD}}
2+
CIBW_SKIP: cp36-* cp37-* cp38-*
3+
CIBW_TEST_REQUIRES: pytest
4+
CIBW_TEST_COMMAND: pytest
85
jobs:
9-
build:
6+
build_sdist:
7+
name: Build source distribution
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: actions/setup-python@v2
12+
name: Install Python
13+
with:
14+
python-version: "3.7"
15+
- name: Build sdist
16+
run: python setup.py sdist
17+
- uses: actions/upload-artifact@v2
18+
with:
19+
path: dist/*.tar.gz
20+
build_wheels:
21+
name: Build wheels on ${{ matrix.os }}
22+
runs-on: ${{ matrix.os }}
1023
strategy:
1124
matrix:
12-
os: [ubuntu-latest, macos-latest, windows-latest]
13-
runs-on: ${{matrix.os}}
25+
os: [ubuntu-18.04, windows-latest, macos-latest]
1426
steps:
15-
- uses: actions/checkout@v2
16-
- name: CI
17-
shell: bash
18-
run: cat bootstrap.sh | bash
27+
- uses: actions/checkout@v2
28+
- uses: actions/setup-python@v2
29+
name: Install Python
30+
with:
31+
python-version: "3.7"
32+
- name: Install cibuildwheel
33+
run: python -m pip install cibuildwheel==1.6.1
34+
- name: Build wheels
35+
run: python -m cibuildwheel --output-dir wheelhouse
36+
- uses: actions/upload-artifact@v2
37+
with:
38+
path: ./wheelhouse/*.whl
39+
name: Build
40+
on: [push, pull_request]

bootstrap.sh

-29
This file was deleted.

build_wheels.py

-146
This file was deleted.

setup.cfg

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
11
[metadata]
22
license_file = LICENSE.md
3-
4-
[wheel]
5-
wheels: 3.6.8 3.7.0 3.8.0

tasks.py

+1-46
Original file line numberDiff line numberDiff line change
@@ -37,52 +37,7 @@ def build(context):
3737
context = MockContext()
3838
context.run(f"{executable} -m pip install --upgrade pip", echo=True)
3939
context.run(f"pip install -r requirements.txt", echo=True)
40-
context.run(
41-
f"{executable} setup.py develop sdist",
42-
env={"CPPFLAGS": "-Werror -Wno-deprecated-declarations"},
43-
replace_env=False,
44-
)
45-
if platform == "linux":
46-
from sys import abiflags
47-
48-
for so in glob("*.so"):
49-
context.run(
50-
f"patchelf --remove-needed libpython{get_python_version()}{abiflags}.so.1.0 {so}",
51-
echo=True,
52-
)
53-
context.run(f"{executable} setup.py bdist_wheel", echo=True)
54-
WHEELS = glob("dist/*.whl")
55-
assert WHEELS, "No wheels in dist!"
56-
print("Before:", *WHEELS, sep="\n - ")
57-
if platform == "linux":
58-
# We're typically eligible for manylinux1... or at least manylinux2010.
59-
# This will remove the wheel if it was unchanged... but that will cause
60-
# our assert to fail later, which is what we want!
61-
context.run(f"pip install -r requirements-audit.txt", echo=True)
62-
for wheel in WHEELS:
63-
context.run(f"auditwheel repair {wheel} -w dist", echo=True)
64-
remove(wheel)
65-
else:
66-
if platform == "darwin":
67-
# We lie here, and say our 10.9 64-bit build is a 10.6 32/64-bit one.
68-
# This is because pip is conservative in what wheels it will use, but
69-
# Python installations are EXTREMELY liberal in their macOS support.
70-
# A typical user may be running a 32/64 Python built for 10.6.
71-
# In reality, we shouldn't worry about supporting 32-bit Snow Leopard.
72-
for wheel in WHEELS:
73-
fake = wheel.replace("macosx_10_9_x86_64", "macosx_10_6_intel")
74-
replace(wheel, fake)
75-
assert (
76-
wheel != fake or "TRAVIS" not in environ
77-
), "We expected a macOS 10.9 x86_64 build!"
78-
# Windows is fine.
79-
FIXED = glob("dist/*.whl")
80-
print("After:", *FIXED, sep="\n - ")
81-
assert len(WHEELS) == len(FIXED), "We gained or lost a wheel!"
82-
83-
context.run("twine check dist/*", echo=True)
84-
for dist in [".", *glob("dist/*.tar.gz"), *glob("dist/*.whl")]:
85-
context.run(f"pip install --force-reinstall --no-cache-dir {dist}", echo=True)
40+
context.run(f"{executable} setup.py develop")
8641

8742

8843
@task(build)

0 commit comments

Comments
 (0)