diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a4b3d65c..57625f83c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -353,6 +353,17 @@ jobs: run: | python3 -m pip install --user --upgrade -r requirements.txt + - name: Install Rust toolchain + run: | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + + - name: Verify Rust installation + run: | + source $HOME/.cargo/env + rustc --version + cargo --version + # For Rocky Linux, we can't cache the dependencies of Open RV # because there is not enough room in the cache (10GB limit) for all platforms. diff --git a/cmake/dependencies/patch/pyopengl-accelerate.patch b/cmake/dependencies/patch/pyopengl-accelerate.patch deleted file mode 100644 index a4f18b7b2..000000000 --- a/cmake/dependencies/patch/pyopengl-accelerate.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/accelerate/src/vbo.pyx b/accelerate/src/vbo.pyx -index 13f9e99d..6e92c059 100644 ---- a/accelerate/src/vbo.pyx -+++ b/accelerate/src/vbo.pyx -@@ -1,6 +1,7 @@ - """Cython-coded VBO implementation""" - #cython: language_level=3 - import ctypes, weakref -+from ctypes import c_long as long - from OpenGL_accelerate.formathandler cimport FormatHandler - from OpenGL import error - from OpenGL._bytes import bytes,unicode diff --git a/cmake/dependencies/python3.cmake b/cmake/dependencies/python3.cmake index a0a5031d5..8f8337b78 100644 --- a/cmake/dependencies/python3.cmake +++ b/cmake/dependencies/python3.cmake @@ -275,16 +275,23 @@ ELSE() ) ENDIF() -# List of packages that are safe to install from pre-built wheels. All other packages (those with C/C++/Rust extensions) will be built from source to ensure -# proper linking against our custom Python build. Packages are built from source unless explicitly listed here. This includes: pure Python packages, build tools -# that don't need ABI compatibility, and packages with data files only. -SET(RV_PYTHON_WHEEL_SAFE +# Build dependencies that must be installed FIRST before building other packages. These are installed from wheels in a separate pip command to ensure they're +# available when packages like PyOpenGL_accelerate need Cython to compile .pyx files. +SET(RV_PYTHON_BUILD_DEPS "pip" # Package installer (pure Python) "setuptools" # Build system (pure Python) "wheel" # Wheel format support (pure Python) - "Cython" # Build tool (compiles Python to C, but the tool itself can use pre-built wheels) + "Cython" # Build tool - MUST be installed before packages with .pyx files "meson-python" # Build backend (pure Python) "ninja" # Build tool (native but doesn't link to Python) + CACHE STRING "Build dependencies to install first (from wheels)" +) + +# List of packages that are safe to install from pre-built wheels. All other packages (those with C/C++/Rust extensions) will be built from source to ensure +# proper linking against our custom Python build. Packages are built from source unless explicitly listed here. This includes: pure Python packages, build tools +# that don't need ABI compatibility, and packages with data files only. +SET(RV_PYTHON_WHEEL_SAFE + ${RV_PYTHON_BUILD_DEPS} # Include build deps in wheel-safe list "PyOpenGL" # OpenGL bindings without acceleration (pure Python) "certifi" # SSL certificate bundle (just data files) "six" # Python 2/3 compatibility (pure Python) @@ -293,9 +300,15 @@ SET(RV_PYTHON_WHEEL_SAFE CACHE STRING "Packages safe to install from wheels (pure Python or build tools)" ) -# Convert list to comma-separated string for pip's --only-binary flag +# Convert lists to space/comma-separated strings for pip commands STRING(REPLACE ";" "," _wheel_safe_packages "${RV_PYTHON_WHEEL_SAFE}") +# Phase 1: Install build dependencies for phase 2. Note: RV_PYTHON_BUILD_DEPS is kept as a CMake list (semicolon-separated) so it expands to separate arguments. +SET(_build_deps_install_command + "${_python3_executable}" -s -E -I -m pip install --upgrade --no-cache-dir ${RV_PYTHON_BUILD_DEPS} +) + +# Phase 2: Install main requirements (with build-from-source for native extensions) SET(_requirements_install_command ${CMAKE_COMMAND} -E env ${_otio_debug_env} ) @@ -375,43 +388,20 @@ EXTERNALPROJECT_ADD( USES_TERMINAL_BUILD TRUE ) -# ############################################################################################################################################################## -# This is temporary until the patch gets into the official PyOpenGL repo. # -# ############################################################################################################################################################## -# Only for Apple Intel. Windows and Linux uses the requirements.txt file to install PyOpenGL-accelerate. -IF(APPLE - AND RV_TARGET_APPLE_X86_64 -) - MESSAGE(STATUS "Patching PyOpenGL and building PyOpenGL from source") - SET(_patch_pyopengl_command - patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/patch/pyopengl-accelerate.patch - ) - - # TODO: pyopengl is now at 3.1.10. Need to check if this is an improvement Still need the patch - # https://github.com/mcfletch/pyopengl/blob/master/accelerate/src/vbo.pyx https://github.com/mcfletch/pyopengl/compare/release-3.1.8...3.1.10 - EXTERNALPROJECT_ADD( - pyopengl_accelerate - URL "https://github.com/mcfletch/pyopengl/archive/refs/tags/release-3.1.8.tar.gz" - URL_MD5 "d7a9e2f8c2d981b58776ded865b3e22a" - DOWNLOAD_NAME release-3.1.8.tar.gz - DOWNLOAD_DIR ${RV_DEPS_DOWNLOAD_DIR} - DOWNLOAD_EXTRACT_TIMESTAMP TRUE - SOURCE_DIR ${CMAKE_BINARY_DIR}/pyopengl_accelerate - PATCH_COMMAND ${_patch_pyopengl_command} - CONFIGURE_COMMAND "" - BUILD_COMMAND "${_python3_executable}" -m pip install ./accelerate - INSTALL_COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_BINARY_DIR}/pyopengl_accelerate/.pip_installed - BUILD_BYPRODUCTS ${CMAKE_BINARY_DIR}/pyopengl_accelerate/setup.py - DEPENDS ${${_python3_target}-requirements-flag} - BUILD_IN_SOURCE TRUE - USES_TERMINAL_BUILD TRUE - ) - - # Ensure pyopengl_accelerate is built as part of the dependencies target - ADD_DEPENDENCIES(dependencies pyopengl_accelerate) -ENDIF() -# ############################################################################################################################################################## +# Phase 1 flag: Build dependencies (Cython, etc.) +SET(${_python3_target}-build-deps-flag + ${_install_dir}/${_python3_target}-build-deps-flag +) + +ADD_CUSTOM_COMMAND( + COMMENT "Installing Python build dependencies (pip, setuptools, wheel, Cython, etc.)" + OUTPUT ${${_python3_target}-build-deps-flag} + COMMAND ${_build_deps_install_command} + COMMAND cmake -E touch ${${_python3_target}-build-deps-flag} + DEPENDS ${_python3_target} +) +# Phase 2 flag: Main requirements (depends on build deps being installed first) SET(${_python3_target}-requirements-flag ${_install_dir}/${_python3_target}-requirements-flag ) @@ -421,7 +411,7 @@ ADD_CUSTOM_COMMAND( OUTPUT ${${_python3_target}-requirements-flag} COMMAND ${_requirements_install_command} COMMAND cmake -E touch ${${_python3_target}-requirements-flag} - DEPENDS ${_python3_target} ${_requirements_output_file} ${_requirements_input_file} + DEPENDS ${_python3_target} ${${_python3_target}-build-deps-flag} ${_requirements_output_file} ${_requirements_input_file} ) # Test the Python distribution after requirements are installed diff --git a/src/build/requirements.txt.in b/src/build/requirements.txt.in index 16c09f0f6..f5e26a869 100644 --- a/src/build/requirements.txt.in +++ b/src/build/requirements.txt.in @@ -6,27 +6,19 @@ # Pure Python packages and build tools safe to install from wheels are listed in RV_PYTHON_WHEEL_SAFE in python3.cmake. # This approach ensures safety by default: new packages will be built from source unless explicitly marked as wheel-safe. -pip # License: MIT License (MIT) -setuptools # License: MIT License -wheel # License: MIT License (MIT) +pip==24.0 # License: MIT License (MIT) +setuptools==69.5.1 # License: MIT License +wheel==0.43.0 # License: MIT License (MIT) numpy==@_numpy_version@ # License: BSD License (BSD-3-Clause) - Required by PySide6 opentimelineio==@_opentimelineio_version@ # License: Other/Proprietary License (Modified Apache 2.0 License) -PyOpenGL # License: BSD License (BSD) - -# MacOS only - PyOpenGL_accelerate is built from source in python3.cmake as a workaround until the fix -# is merged in the main branch. -# See https://github.com/mcfletch/pyopengl/issues/147 and https://github.com/mcfletch/pyopengl/pull/146 - -# PyOpenGL_accelerate as issue with native arm64 build on MacOS. -# Use PyOpenGL_accelerate only on x86_64 platform. -PyOpenGL_accelerate ; (platform_system=='Windows' or platform_system=='Linux') and platform_machine=='x86_64' # License: BSD License (BSD) +PyOpenGL==3.1.7 # License: BSD License (BSD) +PyOpenGL_accelerate==3.1.10 # License: BSD License (BSD) - v3.1.10 includes Python 3 fix for Cython compatibility # Additional packages required by RV and for testing the Python distribution -certifi # License: Mozilla Public License 2.0 (MPL 2.0) (MPL-2.0) - required by test_python.py -six # License: MIT License (MIT) -packaging # License: Apache Software License, BSD License -requests # License: Apache Software License (Apache 2.0) -cryptography # License: Apache Software License, BSD License ((Apache-2.0 OR BSD-3-Clause) AND PSF-2.0) -pydantic # License: MIT License (MIT) - +certifi==2024.2.2 # License: Mozilla Public License 2.0 (MPL 2.0) (MPL-2.0) +six==1.16.0 # License: MIT License (MIT) +packaging==24.0 # License: Apache Software License, BSD License +requests==2.31.0 # License: Apache Software License (Apache 2.0) +cryptography==42.0.5 # License: Apache Software License, BSD License ((Apache-2.0 OR BSD-3-Clause) AND PSF-2.0) +pydantic==2.7.1 # License: MIT License (MIT)