Added app-misc/anki-25.02.7

This commit is contained in:
saundersp
2025-06-26 17:30:16 +02:00
parent fac27ef49e
commit d1f64bf075
8 changed files with 529 additions and 0 deletions

View File

@ -0,0 +1,40 @@
Fix the output path for Rust binaries in the Ninja file to match
Cargo's target directory when CARGO_BUILD_TARGET is set. This prevents
file-not-found errors for some build steps.
Provide the cargo-nextest binary ourselves to prevent network access.
Set test runner options in the ebuild.
From: Lucio Sauer <watermanpaint@posteo.net>
--- a/build/ninja_gen/src/cargo.rs
+++ b/build/ninja_gen/src/cargo.rs
@@ -61,6 +61,9 @@ impl RustOutput<'_> {
let mut path: Utf8PathBuf = rust_base.into();
if let Some(target) = target {
path = path.join(target);
+ } else {
+ let triple = std::env::var("CARGO_BUILD_TARGET").unwrap_or_default();
+ path = path.join(triple);
}
path = path.join(profile_output_dir(build_profile)).join(filename);
path.to_string()
@@ -152,19 +155,11 @@ impl BuildAction for CargoTest {
fn files(&mut self, build: &mut impl FilesHandle) {
build.add_inputs("", &self.inputs);
- build.add_inputs("", inputs![":cargo-nextest"]);
build.add_env_var("ANKI_TEST_MODE", "1");
build.add_output_stamp("tests/cargo_test");
}
fn on_first_instance(&self, build: &mut Build) -> Result<()> {
- build.add_action(
- "cargo-nextest",
- CargoInstall {
- binary_name: "cargo-nextest",
- args: "cargo-nextest --version 0.9.57 --locked",
- },
- )?;
setup_flags(build)
}
}

View File

@ -0,0 +1,28 @@
https://github.com/nipunn1313/mypy-protobuf has not yet been packaged.
It adds typing information to Anki and is only needed for development.
I have packaged some of its test-dependencies on ::guru. Unfortunately,
I'm not too happy yet with the quality of the transitive test-dep
dev-python/pytest-mypy-plugins. Any help is welcome!
From: Lucio Sauer <watermanpaint@posteo.net>
--- a/build/configure/src/python.rs
+++ b/build/configure/src/python.rs
@@ -90,9 +90,7 @@ pub struct GenPythonProto {
impl BuildAction for GenPythonProto {
fn command(&self) -> &str {
"$protoc $
- --plugin=protoc-gen-mypy=$protoc-gen-mypy $
--python_out=$builddir/pylib $
- --mypy_out=$builddir/pylib $
-Iproto $in"
}
@@ -110,7 +108,6 @@ impl BuildAction for GenPythonProto {
.collect();
build.add_inputs("in", &self.proto_files);
build.add_inputs("protoc", inputs![":protoc_binary"]);
- build.add_inputs("protoc-gen-mypy", inputs![":pyenv:protoc-gen-mypy"]);
build.add_outputs("", python_outputs);
}

View File

@ -0,0 +1,21 @@
pip_system_certs is a hack to force certifi to use the system
certificate store. Let's use dev-python/certifi, which is a hack of
its own, instead of introducing an automagical dependency.
From: Lucio Sauer <watermanpaint@posteo.net>
--- a/qt/aqt/__init__.py
+++ b/qt/aqt/__init__.py
@@ -6,13 +6,6 @@ from __future__ import annotations
import logging
import sys
-try:
- import pip_system_certs.wrapt_requests
-except ModuleNotFoundError:
- print(
- "Python module pip_system_certs is not installed. System certificate store and custom SSL certificates may not work. See: https://github.com/ankitects/anki/issues/3016"
- )
-
if sys.version_info[0] < 3 or sys.version_info[1] < 9:
raise Exception("Anki requires Python 3.9+")

View File

@ -0,0 +1,58 @@
Pre-built node_modules allows us to run JS tests but we lose the ability to
hack node packages' source files in YARN_CACHE_FOLDER.
From: Lucio Sauer <watermanpaint@posteo.net>
--- a/build/ninja_gen/src/node.rs
+++ b/build/ninja_gen/src/node.rs
@@ -76,12 +76,11 @@ pub struct YarnInstall<'a> {
impl BuildAction for YarnInstall<'_> {
fn command(&self) -> &str {
- "$runner yarn $yarn $out"
+ "$runner yarn $out"
}
fn files(&mut self, build: &mut impl build::FilesHandle) {
build.add_inputs("", &self.package_json_and_lock);
- build.add_inputs("yarn", inputs![":yarn:bin"]);
build.add_outputs("out", vec!["node_modules/.marker"]);
for (key, value) in &self.exports {
let outputs: Vec<_> = value.iter().map(|o| format!("node_modules/{o}")).collect();
--- a/build/runner/src/yarn.rs
+++ b/build/runner/src/yarn.rs
@@ -1,36 +1,18 @@
// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-use std::env;
use std::path::Path;
-use std::process::Command;
use clap::Args;
-use crate::run::run_command;
-
#[derive(Args)]
pub struct YarnArgs {
- yarn_bin: String,
stamp: String,
}
pub fn setup_yarn(args: YarnArgs) {
link_node_modules();
- if env::var("OFFLINE_BUILD").is_ok() {
- println!("OFFLINE_BUILD is set");
- println!("Running yarn with '--offline' and '--ignore-scripts'.");
- run_command(
- Command::new(&args.yarn_bin)
- .arg("install")
- .arg("--offline")
- .arg("--ignore-scripts"),
- );
- } else {
- run_command(Command::new(&args.yarn_bin).arg("install"));
- }
-
std::fs::write(args.stamp, b"").unwrap();
}