8000 BLD: move cibuildwheel configuration to `pyproject.toml` [wheel build] · numpy/numpy@02e5bc9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 02e5bc9

Browse files
committed
BLD: move cibuildwheel configuration to pyproject.toml [wheel build]
This allows to share the configuration between GitHub Actions and Travis-CI. This also allows to easily run cibuildwheel locally to debug build issues when they arise.
1 parent 1c9ef97 commit 02e5bc9

File tree

3 files changed

+32
-63
lines changed

3 files changed

+32
-63
lines changed

.github/workflows/wheels.yml

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -109,36 +109,11 @@ jobs:
109109
echo "C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw32\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
110110
refreshenv
111111
if: ${{ env.IS_32_BIT == 'true' }}
112+
112113
- name: Build wheels
113114
uses: pypa/cibuildwheel@v2.3.1
114115
env:
115-
NPY_USE_BLAS_ILP64: ${{ env.IS_32_BIT == 'true' && '0' || '1' }}
116116
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}
117-
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
118-
CIBW_ENVIRONMENT_LINUX: CFLAGS='-std=c99 -fno-strict-aliasing'
119-
LDFLAGS='-Wl,--strip-debug'
120-
OPENBLAS64_=/usr/local
121-
RUNNER_OS='Linux'
122-
# MACOS linker doesn't support stripping symbols
123-
CIBW_ENVIRONMENT_MACOS: CFLAGS='-std=c99 -fno-strict-aliasing'
124-
OPENBLAS64_=/usr/local
125-
CC=clang
126-
CXX=clang++
127-
CIBW_ENVIRONMENT_WINDOWS: OPENBLAS64_=${{ env.IS_32_BIT == 'false' && 'openblas' || '' }}
128-
OPENBLAS=${{ env.IS_32_BIT == 'true' && 'openblas' || '' }}
129-
CFLAGS='${{ env.IS_32_BIT == 'true' && '-m32' || '' }}'
130-
LDFLAGS='${{ env.IS_32_BIT == 'true' && '-m32' || '' }}'
131-
# TODO: Add universal2 wheels, we need to fuse them manually
132-
# instead of going through cibuildwheel
133-
# This is because cibuildwheel tries to make a fat wheel
134-
# https://github.com/multi-build/multibuild/blame/devel/README.rst#L541-L565
135-
# for more info
136-
CIBW_ARCHS_MACOS: x86_64 arm64
137-
CIBW_TEST_SKIP: "*_arm64 *_universal2:arm64"
138-
CIBW_BUILD_VERBOSITY: 3
139-
CIBW_BEFORE_BUILD: bash {project}/tools/wheels/cibw_before_build.sh {project}
140-
CIBW_BEFORE_TEST: pip install -r {project}/test_requirements.txt
141-
CIBW_TEST_COMMAND: bash {project}/tools/wheels/cibw_test_command.sh {project}
142117

143118
- uses: actions/upload-artifact@v2
144119
with:

.travis.yml

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,12 @@ jobs:
4545
- ATLAS=None
4646

4747
# Wheel builders
48-
# TODO: de-dup env vars in between steps?
4948
- python: "3.8"
5049
os: linux
5150
arch: arm64
5251
virt: vm
5352
env:
5453
- CIBW_BUILD: cp38-manylinux_aarch64
55-
- CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
56-
- CIBW_BUILD_VERBOSITY: 3
57-
- CIBW_BEFORE_BUILD: "'bash {project}/tools/wheels/cibw_before_build.sh {project}'"
58-
- CIBW_BEFORE_TEST: "'pip install -r {project}/test_requirements.txt'"
59-
- CIBW_TEST_COMMAND: "'bash {project}/tools/wheels/cibw_test_command.sh {project}'"
60-
# Workaround Travis limitations
61-
# set each variable separately and use cibw pass env to pass through
62-
- CFLAGS: "'-std=c99 -fno-strict-aliasing'"
63-
- LDFLAGS: "'-Wl,--strip-debug'"
64-
- OPENBLAS64_: /usr/local
65-
- RUNNER_OS: Linux
66-
- CIBW_ENVIRONMENT_PASS_LINUX: "'CFLAGS LDFLAGS OPENBLAS64_ RUNNER_OS'"
6754
install: python3 -m pip install cibuildwheel==2.3.1
6855
script: |
6956
cibuildwheel --output-dir wheelhouse
@@ -77,18 +64,6 @@ jobs:
7764
virt: vm
7865
env:
7966
- CIBW_BUILD: cp39-manylinux_aarch64
80-
- CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
81-
- CIBW_BUILD_VERBOSITY: 3
82-
- CIBW_BEFORE_BUILD: "'bash {project}/tools/wheels/cibw_before_build.sh {project}'"
83-
- CIBW_BEFORE_TEST: "'pip install -r {project}/test_requirements.txt'"
84-
- CIBW_TEST_COMMAND: "'bash {project}/tools/wheels/cibw_test_command.sh {project}'"
85-
# Workaround Travis limitations
86-
# set each variable separately and use cibw pass env to pass through
87-
- CFLAGS: "'-std=c99 -fno-strict-aliasing'"
88-
- LDFLAGS: "'-Wl,--strip-debug'"
89-
- OPENBLAS64_: /usr/local
90-
- RUNNER_OS: Linux
91-
- CIBW_ENVIRONMENT_PASS_LINUX: "'CFLAGS LDFLAGS OPENBLAS64_ RUNNER_OS'"
9267
install: python3 -m pip install cibuildwheel==2.3.1
9368
script: |
9469
cibuildwheel --output-dir wheelhouse
@@ -102,18 +77,6 @@ jobs:
10277
virt: vm
10378
env:
10479
- CIBW_BUILD: cp310-manylinux_aarch64
105-
- CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
106-
- CIBW_BUILD_VERBOSITY: 3
107-
- CIBW_BEFORE_BUILD: "'bash {project}/tools/wheels/cibw_before_build.sh {project}'"
108-
- CIBW_BEFORE_TEST: "'pip install -r {project}/test_requirements.txt'"
109-
- CIBW_TEST_COMMAND: "'bash {project}/tools/wheels/cibw_test_command.sh {project}'"
110-
# Workaround Travis limitations
111-
# set each variable separately and use cibw pass env to pass through
112-
- CFLAGS: "'-std=c99 -fno-strict-aliasing'"
113-
- LDFLAGS: "'-Wl,--strip-debug'"
114-
- OPENBLAS64_: /usr/local
115-
- RUNNER_OS: Linux
116-
- CIBW_ENVIRONMENT_PASS_LINUX: "'CFLAGS LDFLAGS OPENBLAS64_ RUNNER_OS'"
11780
install: python3 -m pip install cibuildwheel==2.3.1
11881
script: |
11982
cibuildwheel --output-dir wheelhouse

pyproject.toml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,34 @@ requires = [
7474
directory = "change"
7575
name = "Changes"
7676
showcontent = true
77+
78+
79+
[tool.cibuildwheel]
80+
skip = "cp36-* cp37-* pp37-* pp38-macosx* *-manylinux_i686 *_ppc64le *_s390x *-musllinux*"
81+
build-verbosity = "3"
82+
before-build = "bash {project}/tools/wheels/cibw_before_build.sh {project}"
83+
before-test = "pip install -r {project}/test_requirements.txt"
84+
test-command = "bash {project}/tools/wheels/cibw_test_command.sh {project}"
85+
86+
[tool.cibuildwheel.linux]
87+
manylinux-x86_64-image = "manylinux2014"
88+
manylinux-aarch64-image = "manylinux2014"
89+
environment = { CFLAGS="-std=c99 -fno-strict-aliasing", LDFLAGS="-Wl,--strip-debug", OPENBLAS64_="/usr/local", NPY_USE_BLAS_ILP64="1", RUNNER_OS="Linux" }
90+
91+
[tool.cibuildwheel.macos]
92+
# TODO: Add universal2 wheels, we need to fuse them manually
93+
# instead of going through cibuildwheel
94+
# This is because cibuildwheel tries to make a fat wheel
95+
# https://github.com/multi-build/multibuild/blame/devel/README.rst#L541-L565
96+
# for more info
97+
archs = "x86_64 arm64"
98+
test-skip = "*_arm64 *_universal2:arm64"
99+
# MACOS linker doesn't support stripping symbols
100+
environment = { CFLAGS="-std=c99 -fno-strict-aliasing", OPENBLAS64_="/usr/local", NPY_USE_BLAS_ILP64="1", CC="clang", CXX = "clang++" }
101+
102+
[tool.cibuildwheel.windows]
103+
environment = { OPENBLAS64_="openblas", OPENBLAS="", NPY_USE_BLAS_ILP64="1", CFLAGS="", LDFLAGS="" }
104+
105+
[[tool.cibuildwheel.overrides]]
106+
select = "*-win32"
107+
environment = { OPENBLAS64_="", OPENBLAS="openblas", NPY_USE_BLAS_ILP64="0", CFLAGS="-m32", LDFLAGS="-m32" }

0 commit comments

Comments
 (0)
0