Skip to content

Commit abfde12

Browse files
authored
Merge branch 'indygreg:main' into system-zstd-cffi
2 parents 8a9ddf7 + 9eb5694 commit abfde12

File tree

7 files changed

+51
-6
lines changed

7 files changed

+51
-6
lines changed

.github/workflows/external-zstd.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ jobs:
2525
- uses: actions/checkout@v4
2626

2727
- name: Build
28+
env:
29+
PIP_CONSTRAINT: 'ci/constraints.txt'
2830
run: |
2931
python -m pip install --config-settings=--build-option=--system-zstd .
3032
@@ -50,5 +52,7 @@ jobs:
5052
- uses: actions/checkout@v4
5153

5254
- name: Build
55+
env:
56+
PIP_CONSTRAINT: 'ci/constraints.txt'
5357
run: |
5458
python -m pip install --config-settings=--build-option=--system-zstd .

.github/workflows/sphinx.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
with:
1414
version: "0.4.29"
1515
- name: Run Sphinx
16+
env:
17+
PIP_CONSTRAINT: 'ci/constraints.txt'
1618
run: |
1719
uv venv --python 3.12 venv
1820
source venv/bin/activate

.github/workflows/test.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ jobs:
8080
# TODO enable once PyO3 supports 3.13.
8181
- name: Build (Rust)
8282
if: matrix.arch == 'x64' && matrix.py != '3.13'
83+
env:
84+
PIP_CONSTRAINT: 'ci/constraints.txt'
8385
run: |
8486
python -m pip install --config-settings='--build-option=--rust-backend' -e .
8587

.github/workflows/wheel.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ jobs:
104104
arch:
105105
- 'x86'
106106
- 'x64'
107+
- 'arm64'
108+
exclude:
109+
- py: '3.8'
110+
arch: 'arm64'
107111
runs-on: 'windows-2022'
108112
env:
109113
ZSTD_WARNINGS_AS_ERRORS: '1'
@@ -112,14 +116,25 @@ jobs:
112116
uses: actions/setup-python@v5
113117
with:
114118
python-version: ${{ matrix.py }}
115-
architecture: ${{ matrix.arch }}
119+
architecture: ${{ matrix.arch == 'arm64' && 'x64' || matrix.arch }}
116120

117121
- uses: actions/checkout@v4
118122

119123
- name: Build Wheel
124+
if: matrix.arch != 'arm64'
120125
run: |
121126
python -m pip wheel -w dist .
122127
128+
- name: Build Wheel
129+
if: matrix.arch == 'arm64'
130+
shell: bash
131+
run: |
132+
python -m pip install cibuildwheel
133+
export CIBW_ARCHS=ARM64
134+
export CIBW_BUILD=cp$(echo ${{ matrix.py }} | tr -d .)-*
135+
export CIBW_BUILD_VERBOSITY=1
136+
cibuildwheel --output-dir dist --arch ARM64
137+
123138
- name: Upload Wheel
124139
uses: actions/upload-artifact@v4
125140
with:

ci/constraints.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# 69.0.0 breaks handling of --config-settings=--build-option, which our CI
2+
# relies on. So constrained to an older version until we figure out a
3+
# workaround. See comment at
4+
# https://github.com/pypa/pip/issues/11859#issuecomment-2132287974.
5+
setuptools<69.0.0

pyproject.toml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ Documentation = "https://python-zstandard.readthedocs.io/en/latest/"
2929
[build-system]
3030
requires = [
3131
"cffi>=1.17.0",
32-
# 69.0.0 breaks handling of --config-settings=--build-option, which our CI
33-
# relies on. So constrained to an older version until we figure out a
34-
# workaround. See comment at
35-
# https://github.com/pypa/pip/issues/11859#issuecomment-2132287974.
36-
"setuptools<69.0.0",
32+
"setuptools",
3733
]
3834
# Need to use legacy backend because setup_zstd.py breaks build isolation.
3935
build-backend = "setuptools.build_meta:__legacy__"

setup.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,27 @@
3434
if sys.version_info[0:2] >= (3, 13):
3535
MINIMUM_CFFI_VERSION = "1.17"
3636

37+
ext_suffix = os.environ.get("SETUPTOOLS_EXT_SUFFIX")
38+
if ext_suffix:
39+
import sysconfig
40+
# setuptools._distutils.command.build_ext doesn't use
41+
# SETUPTOOLS_EXT_SUFFIX like setuptools.command.build_ext does.
42+
# Work around the issue so that cross-compilation can work
43+
# properly.
44+
sysconfig.get_config_vars()["EXT_SUFFIX"] = ext_suffix
45+
try:
46+
# Older versions of python didn't have EXT_SUFFIX, and setuptools
47+
# sets its own value, but since we've already set one, we don't
48+
# want setuptools to overwrite it.
49+
import setuptools._distutils.compat.py39 as py39compat
50+
except ImportError:
51+
try:
52+
import setuptools._distutils.py39compat as py39compat
53+
except ImportError:
54+
pass
55+
if py39compat:
56+
py39compat.add_ext_suffix = lambda vars: None
57+
3758
try:
3859
import cffi
3960

0 commit comments

Comments
 (0)