mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-08-07 10:20:46 +00:00
build(python): migrate to uv (#5222)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
%global build_version 0
|
||||
%global branch 0
|
||||
%global commit 0
|
||||
%global sunshine_python_version 3.14
|
||||
|
||||
%undefine _hardened_build
|
||||
|
||||
@@ -68,11 +69,10 @@ BuildRequires: nodejs-npm
|
||||
BuildRequires: numactl-devel
|
||||
BuildRequires: opus-devel
|
||||
BuildRequires: pulseaudio-libs-devel
|
||||
BuildRequires: python3-jinja2
|
||||
BuildRequires: python3-setuptools
|
||||
BuildRequires: qt6-qtbase-devel
|
||||
BuildRequires: qt6-qtsvg-devel
|
||||
BuildRequires: systemd-udev
|
||||
BuildRequires: uv
|
||||
%{?sysusers_requires_compat}
|
||||
# for unit tests
|
||||
BuildRequires: xorg-x11-server-Xvfb
|
||||
@@ -243,6 +243,18 @@ cmake_args=(
|
||||
"-DSUNSHINE_PUBLISHER_ISSUE_URL=https://app.lizardbyte.dev/support"
|
||||
)
|
||||
|
||||
%if 0%{?fedora}
|
||||
# uv installs Python and glad's Python dependencies into .venv before CMake runs.
|
||||
cmake_args+=("-DGLAD_SKIP_PIP_INSTALL=ON")
|
||||
cmake_args+=("-DPython_EXECUTABLE=%{_builddir}/Sunshine/.venv/bin/python")
|
||||
%endif
|
||||
|
||||
%if 0%{?suse_version}
|
||||
# Use the Python interpreter that owns the python311-Jinja2/python311-setuptools BuildRequires.
|
||||
cmake_args+=("-DGLAD_SKIP_PIP_INSTALL=ON")
|
||||
cmake_args+=("-DPython_EXECUTABLE=/usr/bin/python3.11")
|
||||
%endif
|
||||
|
||||
export CC=gcc-%{gcc_version}
|
||||
export CXX=g++-%{gcc_version}
|
||||
|
||||
@@ -358,6 +370,14 @@ cmake_args+=("-DSUNSHINE_ENABLE_VULKAN=OFF")
|
||||
|
||||
# cmake
|
||||
cd %{_builddir}/Sunshine
|
||||
%if 0%{?fedora}
|
||||
uv python install %{sunshine_python_version}
|
||||
uv sync \
|
||||
--locked \
|
||||
--only-group glad \
|
||||
--python %{sunshine_python_version} \
|
||||
--no-install-project
|
||||
%endif
|
||||
echo "cmake args:"
|
||||
echo "${cmake_args[@]}"
|
||||
cmake "${cmake_args[@]}"
|
||||
|
||||
@@ -54,8 +54,8 @@ modules:
|
||||
- "modules/ffmpeg.json"
|
||||
|
||||
# Python PyPI build-time dependencies (e.g. jinja2 for glad generator).
|
||||
# glad-dependencies.json is generated at CI time by flatpak-pip-generator and
|
||||
# placed alongside the manifest in the build directory.
|
||||
# glad-dependencies.json is generated from uv.lock at CI time by flatpak-pip-generator
|
||||
# and placed alongside the manifest in the build directory.
|
||||
- "glad-dependencies.json"
|
||||
|
||||
- name: sunshine
|
||||
|
||||
@@ -147,7 +147,7 @@ class Sunshine < Formula
|
||||
# Install jinja2 (required by the glad OpenGL/EGL loader generator) into a
|
||||
# temporary virtualenv. We pass its Python path to cmake via Python_EXECUTABLE
|
||||
# so glad uses the venv Python that has jinja2, and set GLAD_SKIP_PIP_INSTALL=ON
|
||||
# to prevent cmake from trying to pip-install again.
|
||||
# to prevent cmake from trying to install Python dependencies again.
|
||||
# Follows https://docs.brew.sh/Formula-Cookbook#python-dependencies
|
||||
venv = virtualenv_create(buildpath/"venv", "python3")
|
||||
venv.pip_install resources
|
||||
|
||||
Reference in New Issue
Block a user