Skip to content

Commit 9b27f5d

Browse files
authored
Build abi3 wheels with cibuildwheel
1 parent 9c15f06 commit 9b27f5d

2 files changed

Lines changed: 31 additions & 14 deletions

File tree

.github/workflows/wheels.yml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,30 @@ jobs:
66
runs-on: ${{ matrix.os }}
77
strategy:
88
matrix:
9-
os: [ubuntu-latest, windows-latest, macos-latest]
10-
python_version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
9+
include:
10+
- name: manylinux
11+
os: ubuntu-latest
12+
- name: macos
13+
os: macos-latest
14+
- name: win
15+
os: windows-latest
1116

1217
steps:
1318
- uses: actions/checkout@v2
14-
- uses: actions/setup-python@v2
15-
name: Install Python ${{ matrix.python_version }}
1619
with:
17-
python-version: ${{ matrix.python_version }}
20+
submodules: recursive
21+
- uses: actions/setup-python@v2
1822

1923
- name: Install cibuildwheel
20-
run: |
21-
python -m pip install cibuildwheel
24+
run: python -m pip install cibuildwheel
2225
- name: Install Visual C++ for Python 2.7
2326
if: runner.os == 'Windows'
24-
run: |
25-
choco install vcpython27 -f -y
27+
run: choco install vcpython27 -f -y
2628
- name: Build wheels
27-
run: |
28-
python -m cibuildwheel --output-dir wheelhouse
29+
run: python -m cibuildwheel --output-dir wheelhouse
30+
env:
31+
CIBW_BUILD: cp27-${{ matrix.name }}* cp35-${{ matrix.name }}* pp*-${{ matrix.name }}*
2932
- uses: actions/upload-artifact@v2
3033
with:
34+
name: wheels-${{ matrix.name }}
3135
path: ./wheelhouse/*.whl

setup.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env python
22
import os
3+
import platform
4+
import sys
35
from setuptools import find_packages, setup
46
from setuptools.command.build_ext import build_ext
57

@@ -60,6 +62,19 @@ def run(self):
6062
}),
6163
]
6264

65+
cmdclass = {'build_ext': BuildClibBeforeExt}
66+
if sys.version_info > (3,) and platform.python_implementation() == "CPython":
67+
try:
68+
import wheel.bdist_wheel
69+
except ImportError:
70+
pass
71+
else:
72+
class BDistWheel(wheel.bdist_wheel.bdist_wheel):
73+
def finalize_options(self):
74+
self.py_limited_api = "cp3{}".format(sys.version_info[1])
75+
wheel.bdist_wheel.bdist_wheel.finalize_options(self)
76+
cmdclass['bdist_wheel'] = BDistWheel
77+
6378
setup(
6479
name="brotlipy",
6580
version="0.7.0",
@@ -93,9 +108,7 @@ def run(self):
93108

94109
zip_safe=False,
95110

96-
cmdclass={
97-
'build_ext': BuildClibBeforeExt,
98-
},
111+
cmdclass=cmdclass,
99112

100113
classifiers=[
101114
"Programming Language :: Python :: Implementation :: CPython",

0 commit comments

Comments
 (0)