Skip to content

Commit 5f54ed7

Browse files
committed
Install build dependencies in before-build and pass --no-build-isolation
1 parent 2cb8bbc commit 5f54ed7

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

.github/workflows/wheels.yml

+7
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,13 @@ jobs:
142142
shell: bash -el {0}
143143
run: echo "sdist_name=$(cd ./dist && ls -d */)" >> "$GITHUB_ENV"
144144

145+
# TODO: Remove this and installing build deps in cibw_before_build.sh
146+
# after NumPy can be built with a released Cython
147+
- name: Define CIBW_BUILD_FRONTEND environment variable
148+
if: ${{ matrix.python[0] == 'cp313t' }}
149+
run: |
150+
echo "CIBW_BUILD_FRONTEND='pip; args: --no-build-isolation'" >> "$GITHUB_ENV"
151+
145152
- name: Build wheels
146153
uses: pypa/[email protected]
147154
with:

pyproject.toml

+6
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,12 @@ test-command = """
159159
before-build = "pip install delvewheel"
160160
repair-wheel-command = "delvewheel repair -w {dest_dir} {wheel}"
161161

162+
[tool.cibuildwheel.linux]
163+
before-build = "bash {project}/scripts/cibw_before_build.sh"
164+
165+
[tool.cibuildwheel.macos]
166+
before-build = "bash {project}/scripts/cibw_before_build.sh"
167+
162168
[[tool.cibuildwheel.overrides]]
163169
select = "*-musllinux*"
164170
before-test = "apk update && apk add musl-locales"

scripts/cibw_before_build.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# TODO: delete along with enabling build isolation by unsetting
2+
# CIBW_BUILD_FRONTEND when scipy is buildable under free-threaded
3+
# python with a released version of cython
4+
FREE_THREADED_BUILD="$(python -c "import sysconfig; print(bool(sysconfig.get_config_var('Py_GIL_DISABLED')))")"
5+
if [[ $FREE_THREADED_BUILD == "True" ]]; then
6+
python -m pip install -U pip
7+
python -m pip install -i https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy cython
8+
python -m pip install ninja meson-python
9+
fi

0 commit comments

Comments
 (0)