Skip to content

Commit 396f0c4

Browse files
zachlewislgritz
authored andcommitted
ci: Fix broken python wheel building (#4855)
Signed-off-by: Zach Lewis <[email protected]>
1 parent f994436 commit 396f0c4

File tree

4 files changed

+81
-59
lines changed

4 files changed

+81
-59
lines changed

.github/workflows/wheel.yml

Lines changed: 76 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,16 @@ jobs:
157157
name: cibw-wheels-${{ matrix.python }}-${{ matrix.manylinux }}
158158
path: |
159159
./wheelhouse/*.whl
160+
161+
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
162+
with:
163+
name: stubs-${{ matrix.python }}-${{ matrix.manylinux }}
164+
path: |
160165
./wheelhouse/OpenImageIO/__init__.pyi
161-
# if stub validation fails we want to upload the stubs for users to review
162-
if: success() || failure()
166+
# if stub validation fails we want to upload the stubs for users to review.
167+
# keep the python build in sync with the version specified in tool.cibuildwheel.overrides
168+
# section of pyproject.toml
169+
if: always() && contains(matrix.python, 'cp311-manylinux')
163170

164171
# ---------------------------------------------------------------------------
165172
# Linux ARM Wheels
@@ -219,65 +226,78 @@ jobs:
219226
name: cibw-wheels-${{ matrix.python }}-${{ matrix.manylinux }}
220227
path: |
221228
./wheelhouse/*.whl
229+
230+
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
231+
with:
232+
name: stubs-${{ matrix.python }}-${{ matrix.manylinux }}
233+
path: |
222234
./wheelhouse/OpenImageIO/__init__.pyi
223-
# if stub validation fails we want to upload the stubs for users to review
224-
if: success() || failure()
235+
# if stub validation fails we want to upload the stubs for users to review.
236+
# keep the python build in sync with the version specified in tool.cibuildwheel.overrides
237+
# section of pyproject.toml
238+
if: always() && contains(matrix.python, 'cp311-manylinux')
225239

226240
# ---------------------------------------------------------------------------
227241
# macOS Wheels
228242
# ---------------------------------------------------------------------------
229243

230-
# macos:
231-
# name: Build wheels on macOS
232-
# runs-on: macos-13
233-
# if: |
234-
# github.event_name != 'schedule' ||
235-
# github.repository == 'AcademySoftwareFoundation/OpenImageIO'
236-
# strategy:
237-
# matrix:
238-
# include:
239-
# # -------------------------------------------------------------------
240-
# # CPython 64 bits
241-
# # -------------------------------------------------------------------
242-
# - build: CPython 3.9 64 bits
243-
# python: cp39-macosx_x86_64
244-
# arch: x86_64
245-
# - build: CPython 3.10 64 bits
246-
# python: cp310-macosx_x86_64
247-
# arch: x86_64
248-
# - build: CPython 3.11 64 bits
249-
# python: cp311-macosx_x86_64
250-
# arch: x86_64
251-
# - build: CPython 3.12 64 bits
252-
# python: cp312-macosx_x86_64
253-
# arch: x86_64
254-
# - build: CPython 3.13 64 bits
255-
# python: cp313-macosx_x86_64
256-
# arch: x86_64
257-
258-
# steps:
259-
# - name: Checkout repo
260-
# uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
261-
262-
# - name: Install Python
263-
# uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
264-
# with:
265-
# python-version: '3.9'
266-
267-
# - name: Build wheels
268-
# uses: pypa/cibuildwheel@d4a2945fcc8d13f20a1b99d461b8e844d5fc6e23 # v2.21.1
269-
# env:
270-
# CIBW_BUILD: ${{ matrix.python }}
271-
# CIBW_ARCHS: ${{ matrix.arch }}
272-
# CMAKE_GENERATOR: "Unix Makefiles"
273-
# # TODO: Re-enable HEIF when we provide a build recipe that does
274-
# # not include GPL-licensed dynamic libraries.
275-
# USE_Libheif: 'OFF'
276-
277-
# - uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
278-
# with:
279-
# name: cibw-wheels-${{ matrix.python }}
280-
# path: ./wheelhouse/*.whl
244+
macos:
245+
name: Build wheels on macOS
246+
runs-on: macos-13
247+
if: |
248+
github.event_name != 'schedule' ||
249+
github.repository == 'AcademySoftwareFoundation/OpenImageIO'
250+
strategy:
251+
matrix:
252+
include:
253+
# -------------------------------------------------------------------
254+
# CPython 64 bits
255+
# -------------------------------------------------------------------
256+
- build: CPython 3.9 64 bits
257+
python: cp39-macosx_x86_64
258+
arch: x86_64
259+
- build: CPython 3.10 64 bits
260+
python: cp310-macosx_x86_64
261+
arch: x86_64
262+
- build: CPython 3.11 64 bits
263+
python: cp311-macosx_x86_64
264+
arch: x86_64
265+
- build: CPython 3.12 64 bits
266+
python: cp312-macosx_x86_64
267+
arch: x86_64
268+
- build: CPython 3.13 64 bits
269+
python: cp313-macosx_x86_64
270+
arch: x86_64
271+
272+
steps:
273+
- name: Checkout repo
274+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
275+
276+
- name: Install Python
277+
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
278+
with:
279+
python-version: '3.9'
280+
281+
- name: Remove brew OpenEXR/Imath
282+
run: |
283+
brew uninstall --ignore-dependencies openexr imath || true
284+
285+
- name: Build wheels
286+
uses: pypa/cibuildwheel@d4a2945fcc8d13f20a1b99d461b8e844d5fc6e23 # v2.21.1
287+
env:
288+
CIBW_BUILD: ${{ matrix.python }}
289+
CIBW_ARCHS: ${{ matrix.arch }}
290+
MACOSX_DEPLOYMENT_TARGET: 10.15
291+
CMAKE_GENERATOR: "Unix Makefiles"
292+
# TODO: Re-enable HEIF when we provide a build recipe that does
293+
# not include GPL-licensed dynamic libraries.
294+
USE_Libheif: 'OFF'
295+
296+
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
297+
with:
298+
name: cibw-wheels-${{ matrix.python }}
299+
path: ./wheelhouse/*.whl
300+
281301

282302
# ---------------------------------------------------------------------------
283303
# macOS ARM Wheels
@@ -317,7 +337,6 @@ jobs:
317337

318338
- name: Install Python
319339
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
320-
# https://cibuildwheel.pypa.io/en/stable/faq/#macos-building-cpython-38-wheels-on-arm64
321340
with:
322341
python-version: '3.9'
323342

@@ -389,7 +408,7 @@ jobs:
389408

390409

391410
upload_pypi:
392-
needs: [sdist, linux, linux-arm, macos-arm, windows]
411+
needs: [sdist, linux, linux-arm, macos, macos-arm, windows]
393412
runs-on: ubuntu-latest
394413
permissions:
395414
id-token: write

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ if (IGNORE_HOMEBREWED_DEPS)
191191
# Define the list of prefixes to ignore
192192
set (HOMEBREW_PREFIXES
193193
/opt/homebrew
194+
/opt/homebrew/Cellar
194195
/usr/local
196+
/usr/local/Cellar
195197
/usr/X11
196198
/usr/X11R6
197199
/opt/X11

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,14 @@ if.platform-system = "darwin"
8888
if.platform-machine = "arm64"
8989
inherit.cmake.define = "append"
9090
cmake.define.CMAKE_OSX_ARCHITECTURES = "arm64"
91+
cmake.define.CMAKE_OSX_DEPLOYMENT_TARGET = "11"
9192

9293
[[tool.scikit-build.overrides]]
9394
if.platform-system = "darwin"
9495
if.platform-machine = "x86_64"
9596
inherit.cmake.define = "append"
9697
cmake.define.CMAKE_OSX_ARCHITECTURES = "x86_64"
98+
cmake.define.CMAKE_OSX_DEPLOYMENT_TARGET = "10.15"
9799

98100
[tool.cibuildwheel]
99101
build-verbosity = 1
@@ -109,8 +111,6 @@ test-command = "oiiotool --buildinfo"
109111

110112
[tool.cibuildwheel.macos.environment]
111113
SKBUILD_CMAKE_ARGS = "-DLINKSTATIC=1; -DIGNORE_HOMEBREWED_DEPS=1"
112-
# C++17 - std::filesystem is only available in macOS 10.15 and later; ARM compatibility introduced in 11.
113-
MACOSX_DEPLOYMENT_TARGET = "11"
114114
# Optimize for size (not speed).
115115
SKBUILD_CMAKE_BUILD_TYPE = "MinSizeRel"
116116

src/cmake/build_yaml-cpp.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ build_dependency_with_cmake(yaml-cpp
2525
-D YAML_CPP_BUILD_CONTRIB=OFF
2626
-D YAML_BUILD_SHARED_LIBS=${yaml-cpp_BUILD_SHARED_LIBS}
2727
-D CMAKE_INSTALL_LIBDIR=lib
28+
-D CMAKE_POLICY_VERSION_MINIMUM=3.5
2829
)
2930

3031
set (yaml-cpp_ROOT ${yaml-cpp_LOCAL_INSTALL_DIR})

0 commit comments

Comments
 (0)