Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-kde
Path: blob/main/games/anki/files/patch-build_configure_src_python.rs
16461 views
1
Depend on PYTHON_BINARY as well if OFFLINE_BUILD is used to let us specify the
2
current Python interpreter that is used in the system.
3
4
Otherwise the build emits following error message during the creation of
5
the Python wheels:
6
7
[...]
8
FAILED: /wrkdirs/usr/ports/games/anki/work/anki-25.07.2/out/wheels/aqt-25.7.2-py3-none-any.whl
9
/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="A
10
NKI_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=qt
11
× Failed to build `/wrkdirs/usr/ports/games/anki/work/anki-25.07.2/qt`
12
No interpreter found for Python 3.13.5 in virtual environments, managed
13
installations, or search path
14
Failed 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=qt
15
[...]
16
17
The environment variables UV_NO_BUILD_ISOLATION=1 and UV_OFFLINE=1 are also
18
required to run "uv" in offline mode and to make use of the Python packages
19
outside of the pseudo-venv.
20
21
--- build/configure/src/python.rs.orig 2025-07-07 16:49:54 UTC
22
+++ build/configure/src/python.rs
23
@@ -119,11 +119,19 @@ impl BuildAction for BuildWheel {
24
25
impl BuildAction for BuildWheel {
26
fn command(&self) -> &str {
27
- "$uv build --wheel --out-dir=$out_dir --project=$project_dir"
28
+ if std::env::var("OFFLINE_BUILD").is_ok() && std::env::var("PYTHON_BINARY").is_ok() {
29
+ "$uv build --python=$python_binary --wheel --out-dir=$out_dir --project=$project_dir"
30
+ } else {
31
+ "$uv build --wheel --out-dir=$out_dir --project=$project_dir"
32
+ }
33
}
34
35
fn files(&mut self, build: &mut impl FilesHandle) {
36
if std::env::var("OFFLINE_BUILD").ok().as_deref() == Some("1") {
37
+ let python_binary =
38
+ std::env::var("PYTHON_BINARY").expect("PYTHON_BINARY must be set in OFFLINE_BUILD mode");
39
+ build.add_variable("python_binary", python_binary);
40
+
41
let uv_path =
42
std::env::var("UV_BINARY").expect("UV_BINARY must be set in OFFLINE_BUILD mode");
43
build.add_inputs("uv", inputs![uv_path]);
44
45