Skip to content

Commit 40c40b6

Browse files
authored
build: add py3-none-any wheels to the distribution artifacts (#1914)
* Add an option to disable compilation of the binary wheel. * Modify sdist workflow to also produce a py3-none-any wheel. * Correct the reference to the non-binary job.
1 parent 4fa393a commit 40c40b6

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

Diff for: .github/workflows/kit.yml

+14-12
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ jobs:
162162
run: |
163163
python -m pip install -r requirements/kit.pip
164164
165-
- name: "Build wheels"
165+
- name: "Build binary wheels"
166166
env:
167167
CIBW_BUILD: ${{ matrix.py }}*-*
168168
CIBW_ARCHS: ${{ matrix.arch }}
@@ -173,23 +173,23 @@ jobs:
173173
run: |
174174
python -m cibuildwheel --output-dir wheelhouse
175175
176-
- name: "List wheels"
176+
- name: "List binary wheels"
177177
run: |
178178
ls -al wheelhouse/
179179
180180
- name: "Check wheels"
181181
run: |
182182
python -m twine check wheelhouse/*
183183
184-
- name: "Upload wheels"
184+
- name: "Upload binary wheels"
185185
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
186186
with:
187187
name: dist-${{ env.MATRIX_ID }}
188188
path: wheelhouse/*.whl
189189
retention-days: 7
190190

191-
sdist:
192-
name: "Source distribution"
191+
non-binary:
192+
name: "Non-binary artifacts"
193193
runs-on: ubuntu-latest
194194
steps:
195195
- name: "Check out the repo"
@@ -208,23 +208,25 @@ jobs:
208208
run: |
209209
python -m pip install -r requirements/kit.pip
210210
211-
- name: "Build sdist"
211+
- name: "Build non-binary artifacts"
212+
env:
213+
COVERAGE_DISABLE_EXTENSION: 1
212214
run: |
213215
python -m build
214216
215-
- name: "List sdist"
217+
- name: "List non-binary artifacts"
216218
run: |
217219
ls -al dist/
218220
219-
- name: "Check sdist"
221+
- name: "Check non-binary artifacts"
220222
run: |
221223
python -m twine check dist/*
222224
223-
- name: "Upload sdist"
225+
- name: "Upload non-binary artifacts"
224226
uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
225227
with:
226-
name: dist-sdist
227-
path: dist/*.tar.gz
228+
name: dist-non-binary
229+
path: dist/*
228230
retention-days: 7
229231

230232
pypy:
@@ -277,7 +279,7 @@ jobs:
277279
name: "Sign artifacts"
278280
needs:
279281
- wheels
280-
- sdist
282+
- non-binary
281283
- pypy
282284
runs-on: ubuntu-latest
283285
permissions:

Diff for: setup.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,11 @@ def build_extension(self, ext):
170170

171171

172172
# There are a few reasons we might not be able to compile the C extension.
173-
# Figure out if we should attempt the C extension or not.
173+
# Figure out if we should attempt the C extension or not. Define
174+
# COVERAGE_DISABLE_EXTENSION in the build environment to explicitly disable the
175+
# extension.
174176

175-
compile_extension = True
177+
compile_extension = os.getenv("COVERAGE_DISABLE_EXTENSION", None) is None
176178

177179
if "__pypy__" in sys.builtin_module_names:
178180
# Pypy can't compile C extensions

0 commit comments

Comments
 (0)