Skip to content

Commit 8132aa4

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

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
@@ -165,9 +165,16 @@ jobs:
165165
name: cibw-wheels-${{ matrix.python }}-${{ matrix.manylinux }}
166166
path: |
167167
./wheelhouse/*.whl
168+
169+
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
170+
with:
171+
name: stubs-${{ matrix.python }}-${{ matrix.manylinux }}
172+
path: |
168173
./wheelhouse/OpenImageIO/__init__.pyi
169-
# if stub validation fails we want to upload the stubs for users to review
170-
if: success() || failure()
174+
# if stub validation fails we want to upload the stubs for users to review.
175+
# keep the python build in sync with the version specified in tool.cibuildwheel.overrides
176+
# section of pyproject.toml
177+
if: always() && contains(matrix.python, 'cp311-manylinux')
171178

172179
# ---------------------------------------------------------------------------
173180
# Linux ARM Wheels
@@ -231,65 +238,78 @@ jobs:
231238
name: cibw-wheels-${{ matrix.python }}-${{ matrix.manylinux }}
232239
path: |
233240
./wheelhouse/*.whl
241+
242+
- uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0
243+
with:
244+
name: stubs-${{ matrix.python }}-${{ matrix.manylinux }}
245+
path: |
234246
./wheelhouse/OpenImageIO/__init__.pyi
235-
# if stub validation fails we want to upload the stubs for users to review
236-
if: success() || failure()
247+
# if stub validation fails we want to upload the stubs for users to review.
248+
# keep the python build in sync with the version specified in tool.cibuildwheel.overrides
249+
# section of pyproject.toml
250+
if: always() && contains(matrix.python, 'cp311-manylinux')
237251

238252
# ---------------------------------------------------------------------------
239253
# macOS Wheels
240254
# ---------------------------------------------------------------------------
241255

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

294314
# ---------------------------------------------------------------------------
295315
# macOS ARM Wheels
@@ -332,7 +352,6 @@ jobs:
332352

333353
- name: Install Python
334354
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
335-
# https://cibuildwheel.pypa.io/en/stable/faq/#macos-building-cpython-38-wheels-on-arm64
336355
with:
337356
python-version: '3.8'
338357

@@ -407,7 +426,7 @@ jobs:
407426

408427

409428
upload_pypi:
410-
needs: [sdist, linux, linux-arm, macos-arm, windows]
429+
needs: [sdist, linux, linux-arm, macos, macos-arm, windows]
411430
runs-on: ubuntu-latest
412431
permissions:
413432
id-token: write

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,9 @@ if (IGNORE_HOMEBREWED_DEPS)
179179
# Define the list of prefixes to ignore
180180
set (HOMEBREW_PREFIXES
181181
/opt/homebrew
182+
/opt/homebrew/Cellar
182183
/usr/local
184+
/usr/local/Cellar
183185
/usr/X11
184186
/usr/X11R6
185187
/opt/X11

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,14 @@ if.platform-system = "darwin"
8686
if.platform-machine = "arm64"
8787
inherit.cmake.define = "append"
8888
cmake.define.CMAKE_OSX_ARCHITECTURES = "arm64"
89+
cmake.define.CMAKE_OSX_DEPLOYMENT_TARGET = "11"
8990

9091
[[tool.scikit-build.overrides]]
9192
if.platform-system = "darwin"
9293
if.platform-machine = "x86_64"
9394
inherit.cmake.define = "append"
9495
cmake.define.CMAKE_OSX_ARCHITECTURES = "x86_64"
96+
cmake.define.CMAKE_OSX_DEPLOYMENT_TARGET = "10.15"
9597

9698
[tool.cibuildwheel]
9799
build-verbosity = 1
@@ -107,8 +109,6 @@ test-command = "oiiotool --buildinfo"
107109

108110
[tool.cibuildwheel.macos.environment]
109111
SKBUILD_CMAKE_ARGS = "-DLINKSTATIC=1; -DIGNORE_HOMEBREWED_DEPS=1"
110-
# C++17 - std::filesystem is only available in macOS 10.15 and later; ARM compatibility introduced in 11.
111-
MACOSX_DEPLOYMENT_TARGET = "11"
112112
# Optimize for size (not speed).
113113
SKBUILD_CMAKE_BUILD_TYPE = "MinSizeRel"
114114

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)