Skip to content

Commit

Permalink
Build architecture independent wheels.
Browse files Browse the repository at this point in the history
Fix #1300.
  • Loading branch information
aaugustin committed Apr 1, 2023
1 parent 6dcac04 commit d3d4cf4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ on:

jobs:
sdist:
name: Build source distribution
name: Build source distribution and architecture-independent wheel
runs-on: ubuntu-latest
env:
BUILD_EXTENSION: no
steps:
- name: Check out repository
uses: actions/checkout@v3
Expand All @@ -23,10 +25,20 @@ jobs:
uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
- name: Install wheel
run: pip install wheel
- name: Build wheel
run: python setup.py bdist_wheel
- name: Save wheel
uses: actions/upload-artifact@v3
with:
path: dist/*.whl

wheels:
name: Build wheels on ${{ matrix.os }}
name: Build architecture-specific wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
BUILD_EXTENSION: yes
strategy:
matrix:
os:
Expand All @@ -36,8 +48,6 @@ jobs:
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Make extension build mandatory
run: touch .cibuildwheel
- name: Install Python 3.x
uses: actions/setup-python@v4
with:
Expand Down
7 changes: 5 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import pathlib
import re

Expand Down Expand Up @@ -27,11 +28,13 @@
"websockets/sync",
]

ext_modules = [
# Set BUILD_EXTENSION to yes or no to force building or not building the
# speedups extension. If unset, the extension is built only if possible.
ext_modules = [] if os.environ.get("BUILD_EXTENSION") == "no" else [
setuptools.Extension(
"websockets.speedups",
sources=["src/websockets/speedups.c"],
optional=not (root_dir / ".cibuildwheel").exists(),
optional=os.environ.get("BUILD_EXTENSION") != "yes",
)
]

Expand Down

0 comments on commit d3d4cf4

Please sign in to comment.