Path: blob/main/games/anki/files/patch-build_configure_src_python.rs
16461 views
Depend on PYTHON_BINARY as well if OFFLINE_BUILD is used to let us specify the1current Python interpreter that is used in the system.23Otherwise the build emits following error message during the creation of4the Python wheels:56[...]7FAILED: /wrkdirs/usr/ports/games/anki/work/anki-25.07.2/out/wheels/aqt-25.7.2-py3-none-any.whl8/wrkdirs/usr/ports/games/anki/work/anki-25.07.2/out/rust/release/runner run --env="UV_PROJECT_ENVIRONMENT=/wrkdirs/usr/ports/games/anki/work/anki-25.07.2/out/pyenv" --env="A9NKI_WHEEL_TAG=py3-none-any" /usr/local/bin/uv build --wheel --out-dir=/wrkdirs/usr/ports/games/anki/work/anki-25.07.2/out/wheels/ --project=qt10× Failed to build `/wrkdirs/usr/ports/games/anki/work/anki-25.07.2/qt`11╰─▶ No interpreter found for Python 3.13.5 in virtual environments, managed12installations, or search path13Failed with code Some(2): /usr/local/bin/uv build --wheel --out-dir=/wrkdirs/usr/ports/games/anki/work/anki-25.07.2/out/wheels/ --project=qt14[...]1516The environment variables UV_NO_BUILD_ISOLATION=1 and UV_OFFLINE=1 are also17required to run "uv" in offline mode and to make use of the Python packages18outside of the pseudo-venv.1920--- build/configure/src/python.rs.orig 2025-07-07 16:49:54 UTC21+++ build/configure/src/python.rs22@@ -119,11 +119,19 @@ impl BuildAction for BuildWheel {2324impl BuildAction for BuildWheel {25fn command(&self) -> &str {26- "$uv build --wheel --out-dir=$out_dir --project=$project_dir"27+ if std::env::var("OFFLINE_BUILD").is_ok() && std::env::var("PYTHON_BINARY").is_ok() {28+ "$uv build --python=$python_binary --wheel --out-dir=$out_dir --project=$project_dir"29+ } else {30+ "$uv build --wheel --out-dir=$out_dir --project=$project_dir"31+ }32}3334fn files(&mut self, build: &mut impl FilesHandle) {35if std::env::var("OFFLINE_BUILD").ok().as_deref() == Some("1") {36+ let python_binary =37+ std::env::var("PYTHON_BINARY").expect("PYTHON_BINARY must be set in OFFLINE_BUILD mode");38+ build.add_variable("python_binary", python_binary);39+40let uv_path =41std::env::var("UV_BINARY").expect("UV_BINARY must be set in OFFLINE_BUILD mode");42build.add_inputs("uv", inputs![uv_path]);434445