diff options
| author | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-15 13:54:21 -0600 |
|---|---|---|
| committer | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-02-15 13:54:21 -0600 |
| commit | 2d5cf8d6d6f137bb10b2a63823fc5382d7c78602 (patch) | |
| tree | 4da6093e46d26a8aa199edc2d920c6b323a47993 /CMakeLists.txt | |
| parent | 49918c699153ad35290f961ae150bf5d4513e440 (diff) | |
Replace Python build deps with uv across all build paths
Use uv as the single Python package manager for Docker, source, and
Flatpak builds. Python 3.13 and pybind11==2.13.6 are now consistent
across all three paths.
- Docker: install uv + build venv instead of python3-dev/pip/pybind11-dev
- CMake: bootstrap pyvenv with uv (REQUIRED/FATAL_ERROR) when no
explicit Python provided; pin pybind11==2.13.6, add sip
- Flatpak: remove pybind11 cmake module, use uv pip install --target
for build deps, uv for portable Python packages
- build-inner.sh: use BUILD_PY throughout, uv pip install for portable
runtime packages, simplify embed check to direct Python invocation
- VFS helper: fall back to shared libfuse3 when static .a unavailable
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a78fd1..a7d3451 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,35 +165,35 @@ if(BUILD_BSA_FFI) endif() if(BUILD_PLUGIN_PYTHON) - set(_mo2_pyvenv "${CMAKE_SOURCE_DIR}/build/pyvenv") - set(_mo2_pyvenv_python "${_mo2_pyvenv}/bin/python") + # If an explicit Python executable was provided (Docker/CI), use it directly. + # Otherwise, bootstrap a local venv with uv for source builds. + if(NOT DEFINED Python_EXECUTABLE OR NOT Python_EXECUTABLE) + set(_mo2_pyvenv "${CMAKE_SOURCE_DIR}/build/pyvenv") + set(_mo2_pyvenv_python "${_mo2_pyvenv}/bin/python") - # Bootstrap a local Python venv with uv if the pyvenv doesn't exist yet. - if(NOT EXISTS "${_mo2_pyvenv_python}") - find_program(_uv_exe uv) - if(_uv_exe) + if(NOT EXISTS "${_mo2_pyvenv_python}") + find_program(_uv_exe uv REQUIRED) message(STATUS "Bootstrapping Python venv with uv...") execute_process( COMMAND ${_uv_exe} venv "${_mo2_pyvenv}" --python 3.13 --seed RESULT_VARIABLE _uv_venv_rc) - if(_uv_venv_rc EQUAL 0) - execute_process( - COMMAND ${_uv_exe} pip install --python "${_mo2_pyvenv_python}" - pybind11 psutil vdf - RESULT_VARIABLE _uv_pip_rc) - if(NOT _uv_pip_rc EQUAL 0) - message(WARNING "uv pip install failed (rc=${_uv_pip_rc})") - endif() - else() - message(WARNING "uv venv creation failed (rc=${_uv_venv_rc})") + if(NOT _uv_venv_rc EQUAL 0) + message(FATAL_ERROR + "uv venv creation failed (rc=${_uv_venv_rc}). " + "Install uv: https://docs.astral.sh/uv/") + endif() + execute_process( + COMMAND ${_uv_exe} pip install --python "${_mo2_pyvenv_python}" + pybind11==2.13.6 sip psutil vdf + RESULT_VARIABLE _uv_pip_rc) + if(NOT _uv_pip_rc EQUAL 0) + message(FATAL_ERROR "uv pip install failed (rc=${_uv_pip_rc})") endif() endif() - endif() - if(EXISTS "${_mo2_pyvenv_python}") set(Python_EXECUTABLE "${_mo2_pyvenv_python}" CACHE FILEPATH "Python executable for plugin_python build" FORCE) - # Detect pybind11 cmake dir dynamically (version-independent path). + # Detect pybind11 cmake dir dynamically. execute_process( COMMAND "${_mo2_pyvenv_python}" -c "import pybind11; print(pybind11.get_cmake_dir())" |
