Anki/pylib/rsbridge/build.rs
Damien Elmes 7ba32cce6d Migrate build system to uv
Closes #3787, and is a step towards #3081 and #4022

This change breaks our PyOxidizer bundling process. While we probably
could update it to work with the new venvs & lockfile, my intention
is to use this as a base to try out a uv-based packager/installer.

Still to do:
- move mpv distribution to a wheel
- build the new uv-based installer.

Some notes about the changes:

- Use uv for python download + venv installation
- Drop python/requirements* in favour of pyproject files / uv.lock
- Bumped to latest Python 3.9 version. The move to 3.13 should be
a fairly trivial change when we're ready.
- Dropped the old write_wheel.py in favour of uv/hatchling. This has
the unfortunate side-effect of dropping leading zeros in our wheels,
which we could try hack around in the future.
- Switch to Qt 6.7 for the dev repo, as it's the first PyQt version
with a Linux/ARM WebEngine wheel.
- Unified our macOS deployment target with minimum required for ARM.
- Dropped unused fluent python files
- Dropped unused python license generation
- Dropped helpers to run under Qt 5, as our wheels were already
requiring Qt 6 to install.
2025-06-16 19:20:12 +07:00

33 lines
1.1 KiB
Rust

// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
fn main() {
// macOS needs special link flags for PyO3
if cfg!(target_os = "macos") {
println!("cargo:rustc-link-arg=-undefined");
println!("cargo:rustc-link-arg=dynamic_lookup");
println!("cargo:rustc-link-arg=-mmacosx-version-min=11");
}
// On Windows, we need to be able to link with python3.lib
if cfg!(windows) {
use std::process::Command;
// Run Python to get sysconfig paths
let output = Command::new("../../out/pyenv/scripts/python")
.args([
"-c",
"import sysconfig; print(sysconfig.get_paths()['stdlib'])",
])
.output()
.expect("Failed to execute Python");
let stdlib_path = String::from_utf8(output.stdout)
.expect("Failed to parse Python output")
.trim()
.to_string();
let libs_path = stdlib_path + "s";
println!("cargo:rustc-link-search={}", libs_path);
}
}