Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions build/configure/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use ninja_gen::protobuf::check_proto;
use ninja_gen::protobuf::setup_protoc;
use ninja_gen::python::setup_uv;
use ninja_gen::Build;
use platform::overriden_python_venv_platform;
use pylib::build_pylib;
use pylib::check_pylib;
use python::check_python;
Expand Down Expand Up @@ -48,10 +47,7 @@ fn main() -> Result<()> {
check_proto(build, inputs![glob!["proto/**/*.proto"]])?;

if env::var("OFFLINE_BUILD").is_err() {
setup_uv(
build,
overriden_python_venv_platform().unwrap_or(build.host_platform),
)?;
setup_uv(build, build.host_platform)?;
}
setup_venv(build)?;

Expand Down
14 changes: 2 additions & 12 deletions build/configure/src/platform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,7 @@ pub fn overriden_rust_target_triple() -> Option<&'static str> {
overriden_python_wheel_platform().map(|p| p.as_rust_triple())
}

/// Usually None to use the host architecture, except on Windows which
/// always uses x86_64, since WebEngine is unavailable for ARM64.
pub fn overriden_python_venv_platform() -> Option<Platform> {
if cfg!(target_os = "windows") {
Some(Platform::WindowsX64)
} else {
None
}
}

/// Like [`overriden_python_venv_platform`], but:
/// Usually None to use the host architecture, but:
/// If MAC_X86 is set, an X86 wheel will be built on macOS ARM.
/// If LIN_ARM64 is set, an ARM64 wheel will be built on Linux AMD64.
pub fn overriden_python_wheel_platform() -> Option<Platform> {
Expand All @@ -29,6 +19,6 @@ pub fn overriden_python_wheel_platform() -> Option<Platform> {
} else if env::var("LIN_ARM64").is_ok() {
Some(Platform::LinuxArm)
} else {
overriden_python_venv_platform()
None
}
}
24 changes: 12 additions & 12 deletions build/ninja_gen/src/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,38 @@ pub fn uv_archive(platform: Platform) -> OnlineArchive {
match platform {
Platform::LinuxX64 => {
OnlineArchive {
url: "https://github.com/astral-sh/uv/releases/download/0.7.13/uv-x86_64-unknown-linux-gnu.tar.gz",
sha256: "909278eb197c5ed0e9b5f16317d1255270d1f9ea4196e7179ce934d48c4c2545",
url: "https://github.com/astral-sh/uv/releases/download/0.10.11/uv-x86_64-unknown-linux-gnu.tar.gz",
sha256: "5a360b0de092ddf4131f5313d0411b48c4e95e8107e40c3f8f2e9fcb636b3583",
}
},
Platform::LinuxArm => {
OnlineArchive {
url: "https://github.com/astral-sh/uv/releases/download/0.7.13/uv-aarch64-unknown-linux-gnu.tar.gz",
sha256: "0b2ad9fe4295881615295add8cc5daa02549d29cc9a61f0578e397efcf12f08f",
url: "https://github.com/astral-sh/uv/releases/download/0.10.11/uv-aarch64-unknown-linux-gnu.tar.gz",
sha256: "23003df007937dd607409c8ddf010baa82bad2673e60e254632ca5b04edcce13",
}
},
Platform::MacX64 => {
OnlineArchive {
url: "https://github.com/astral-sh/uv/releases/download/0.7.13/uv-x86_64-apple-darwin.tar.gz",
sha256: "d785753ac092e25316180626aa691c5dfe1fb075290457ba4fdb72c7c5661321",
url: "https://github.com/astral-sh/uv/releases/download/0.10.11/uv-x86_64-apple-darwin.tar.gz",
sha256: "ff90020b554cf02ef8008535c9aab6ef27bb7be6b075359300dec79c361df897",
}
},
Platform::MacArm => {
OnlineArchive {
url: "https://github.com/astral-sh/uv/releases/download/0.7.13/uv-aarch64-apple-darwin.tar.gz",
sha256: "721f532b73171586574298d4311a91d5ea2c802ef4db3ebafc434239330090c6",
url: "https://github.com/astral-sh/uv/releases/download/0.10.11/uv-aarch64-apple-darwin.tar.gz",
sha256: "437a7d498dd6564d5bf986074249ba1fc600e73da55ae04d7bd4c24d5f149b95",
}
},
Platform::WindowsX64 => {
OnlineArchive {
url: "https://github.com/astral-sh/uv/releases/download/0.7.13/uv-x86_64-pc-windows-msvc.zip",
sha256: "e199b10bef1a7cc540014483e7f60f825a174988f41020e9d2a6b01bd60f0669",
url: "https://github.com/astral-sh/uv/releases/download/0.10.11/uv-x86_64-pc-windows-msvc.zip",
sha256: "9ee74df98582f37fdd6069e1caac80d2616f9a489f5dbb2b1c152f30be69c58e",
}
},
Platform::WindowsArm => {
OnlineArchive {
url: "https://github.com/astral-sh/uv/releases/download/0.7.13/uv-aarch64-pc-windows-msvc.zip",
sha256: "bb40708ad549ad6a12209cb139dd751bf0ede41deb679ce7513ce197bd9ef234",
url: "https://github.com/astral-sh/uv/releases/download/0.10.11/uv-aarch64-pc-windows-msvc.zip",
sha256: "6a3eec4105c775dd87c11ef8ec41564648273751ff807c8955c24ddbcc636d03",
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion pylib/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "anki"
dynamic = ["version"]
requires-python = ">=3.9"
requires-python = ">=3.10"
license = "AGPL-3.0-or-later"
dependencies = [
"decorator",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "anki-dev"
version = "0.0.0"
description = "Local-only environment"
requires-python = ">=3.9"
requires-python = ">=3.10"
classifiers = ["Private :: Do Not Upload"]

[dependency-groups]
Expand Down
2 changes: 1 addition & 1 deletion qt/launcher/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "anki-launcher"
version = "1.0.0"
description = "UV-based launcher for Anki."
requires-python = ">=3.9"
requires-python = ">=3.10"
dependencies = [
"anki-release",
]
16 changes: 12 additions & 4 deletions qt/launcher/src/bin/build_win.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ fn setup_directories(output_dir: &Path, launcher_exe_dir: &Path, nsis_dir: &Path
Ok(())
}

const fn get_arch_triple() -> &'static str {
if cfg!(target_arch = "aarch64") {
"aarch64-pc-windows-msvc"
} else {
"x86_64-pc-windows-msvc"
}
}

fn build_launcher_binary() -> Result<()> {
println!("Building launcher binary...");

Expand All @@ -88,7 +96,7 @@ fn build_launcher_binary() -> Result<()> {
"launcher",
"--release",
"--target",
"x86_64-pc-windows-msvc",
get_arch_triple(),
])
.ensure_success()?;

Expand Down Expand Up @@ -116,16 +124,16 @@ fn extract_nsis_plugins() -> Result<()> {

fn copy_files(output_dir: &Path) -> Result<()> {
println!("Copying binaries...");

let platform = get_arch_triple();
// Copy launcher binary as anki.exe
let launcher_src =
PathBuf::from(CARGO_TARGET_DIR).join("x86_64-pc-windows-msvc/release/launcher.exe");
PathBuf::from(CARGO_TARGET_DIR).join(format!("{platform}/release/launcher.exe"));
let launcher_dst = output_dir.join("anki.exe");
copy_file(&launcher_src, &launcher_dst)?;

// Copy anki-console binary
let console_src =
PathBuf::from(CARGO_TARGET_DIR).join("x86_64-pc-windows-msvc/release/anki-console.exe");
PathBuf::from(CARGO_TARGET_DIR).join(format!("{platform}/release/anki-console.exe"));
let console_dst = output_dir.join("anki-console.exe");
copy_file(&console_src, &console_dst)?;

Expand Down
2 changes: 1 addition & 1 deletion qt/mac/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "anki-mac-helper"
version = "0.1.1"
description = "Small support library for Anki on Macs"
requires-python = ">=3.9"
requires-python = ">=3.10"
license = { text = "AGPL-3.0-or-later" }
authors = [
{ name = "Anki Team" },
Expand Down
14 changes: 7 additions & 7 deletions qt/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "aqt"
dynamic = ["version"]
requires-python = ">=3.9"
requires-python = ">=3.10"
license = "AGPL-3.0-or-later"
dependencies = [
"beautifulsoup4",
Expand All @@ -21,7 +21,7 @@ dependencies = [

[project.optional-dependencies]
audio = [
"anki-audio==0.1.0; sys.platform == 'win32' or sys.platform == 'darwin'",
"anki-audio==0.1.0; sys.platform == 'win32' and platform_machine == 'x86_64' or sys.platform == 'darwin'",
]
qt66 = [
"pyqt6==6.6.1",
Expand All @@ -38,11 +38,11 @@ qt67 = [
"pyqt6_sip==13.10.2",
]
qt = [
"pyqt6==6.9.1",
"pyqt6-qt6==6.9.1",
"pyqt6-webengine==6.8.0",
"pyqt6-webengine-qt6==6.8.2",
"pyqt6_sip==13.10.2",
"pyqt6==6.10.2",
"pyqt6-qt6==6.10.2",
"pyqt6-webengine==6.10.0",
"pyqt6-webengine-qt6==6.10.0",
"pyqt6_sip==13.11.1",
]
qt68 = [
"pyqt6==6.8.0",
Expand Down
2 changes: 1 addition & 1 deletion qt/release/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ cat > pyproject.toml << EOF
name = "anki-release"
version = "$VERSION"
description = "A package to lock Anki's dependencies"
requires-python = ">=3.9"
requires-python = ">=3.10"
dependencies = [
"anki==$VERSION",
"aqt==$VERSION",
Expand Down
Loading
Loading