From 6fa40a4f6c3f0dd9f52f2476c3279927d5f23d71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Achard?= Date: Tue, 10 Dec 2024 21:53:28 +0000 Subject: [PATCH] Fix Python wheel macOS workflow and make OCIO_PYTHON_LOAD_DLLS_FROM_PATH opt-in (#2106) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Achard Co-authored-by: Doug Walker --- .github/workflows/wheel_workflow.yml | 10 +++++----- docs/quick_start/installation.rst | 8 ++++---- src/bindings/python/package/__init__.py | 10 ++++++---- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.github/workflows/wheel_workflow.yml b/.github/workflows/wheel_workflow.yml index d940ac69a9..ff7b666fdb 100644 --- a/.github/workflows/wheel_workflow.yml +++ b/.github/workflows/wheel_workflow.yml @@ -174,7 +174,7 @@ jobs: platforms: all - name: Build wheels - uses: pypa/cibuildwheel@v2.21.1 + uses: pypa/cibuildwheel@v2.22.0 env: CIBW_BUILD: ${{ matrix.python }} CIBW_ARCHS: ${{ matrix.arch }} @@ -192,7 +192,7 @@ jobs: macos: name: Build wheels on macOS - runs-on: macos-12 + runs-on: macos-13 # Don't run on OCIO forks if: | github.event_name != 'schedule' || @@ -231,7 +231,7 @@ jobs: python-version: '3.9' - name: Build wheels - uses: pypa/cibuildwheel@v2.21.1 + uses: pypa/cibuildwheel@v2.22.0 env: CIBW_BUILD: ${{ matrix.python }} CIBW_ARCHS: ${{ matrix.arch }} @@ -286,7 +286,7 @@ jobs: python-version: '3.9' - name: Build wheels - uses: pypa/cibuildwheel@v2.21.1 + uses: pypa/cibuildwheel@v2.22.0 env: CIBW_BUILD: ${{ matrix.python }} CIBW_ARCHS: ${{ matrix.arch }} @@ -341,7 +341,7 @@ jobs: python-version: '3.9' - name: Build wheels - uses: pypa/cibuildwheel@v2.21.1 + uses: pypa/cibuildwheel@v2.22.0 env: CIBW_BUILD: ${{ matrix.python }} CIBW_ARCHS: ${{ matrix.arch }} diff --git a/docs/quick_start/installation.rst b/docs/quick_start/installation.rst index 5c34c9fe99..8b8e275d53 100644 --- a/docs/quick_start/installation.rst +++ b/docs/quick_start/installation.rst @@ -126,7 +126,7 @@ Required components: - CMake >= 3.14 - \*Expat >= 2.4.1 (XML parser for CDL/CLF/CTF) - \*yaml-cpp >= 0.7.0 (YAML parser for Configs) -- \*Imath >= 3.0 (for half domain LUTs) +- \*Imath >= 3.1.1 (for half domain LUTs) - \*pystring >= 1.1.3 - \*minizip-ng >= 3.0.7 (for config archiving) - \*ZLIB >= 1.2.13 (for config archiving) @@ -135,14 +135,14 @@ Optional OCIO functionality also depends on: - \*Little CMS >= 2.2 (for ociobakelut ICC profile baking) - \*OpenGL GLUT & GLEW (for ociodisplay) -- \*OpenEXR >= 3.0 (for apps including ocioconvert) -- OpenImageIO >= 2.1.9 (for apps including ocioconvert) +- \*OpenEXR >= 3.0.5 (for apps including ocioconvert) +- OpenImageIO >= 2.2.14 (for apps including ocioconvert) - \*OpenFX >= 1.4 (for the OpenFX plug-ins) - OpenShadingLanguage >= 1.11 (for the OSL unit tests) - Doxygen (for the docs) - NumPy (optionally used in the Python test suite) - \*pybind11 >= 2.9.2 (for the Python binding) -- Python >= 2.7 (for the Python binding only) +- Python >= 3.7 (for the Python binding only) - Python 3.7 - 3.9 (for building the documentation) Building the documentation requires the following packages, available via PyPI: diff --git a/src/bindings/python/package/__init__.py b/src/bindings/python/package/__init__.py index 800c7968ae..e5fa6868f2 100644 --- a/src/bindings/python/package/__init__.py +++ b/src/bindings/python/package/__init__.py @@ -24,13 +24,15 @@ # 2 - Checking that the directories exist and are not "." # 3 - Add them to the DLL load path. # -# The behavior described above is opt-out which means that it is activated by default. -# A user can opt-out and use the default behavior of Python 3.8+ by setting OCIO_PYTHON_LOAD_DLLS_FROM_PATH -# environment variable to 0. +# The behavior described above is opt-in which means that it is deactivated by default. +# A user can opt-in by setting OCIO_PYTHON_LOAD_DLLS_FROM_PATH environment variable to 1. +# Please note that OCIO 2.4.0 and earlier had this behavior opt-out but it was changed +# in 2.4.1 after it was found problematic in uncontrolled environment (causing segfault +# on PyOpenColorIO import) as well as for security reasons. # if sys.version_info >= (3, 8) and platform.system() == "Windows": - if os.getenv("OCIO_PYTHON_LOAD_DLLS_FROM_PATH", "1") == "1": + if os.getenv("OCIO_PYTHON_LOAD_DLLS_FROM_PATH", "0") == "1": for path in os.getenv("PATH", "").split(os.pathsep): if os.path.exists(path) and path != ".": os.add_dll_directory(path)