Unverified Commit 5301a08a authored by Emily's avatar Emily Committed by GitHub
Browse files

Merge pull request #333602 from martinetd/anki_rust_1.80

anki: 24.06.2 -> 24.06.3, rust 1.80 fix
parents a0a63aa8 25ab2f0f
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -5581,9 +5581,9 @@ dependencies = [

[[package]]
name = "time"
version = "0.3.34"
version = "0.3.36"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749"
checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
dependencies = [
 "deranged",
 "itoa",
@@ -5602,9 +5602,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"

[[package]]
name = "time-macros"
version = "0.2.17"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774"
checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
dependencies = [
 "num-conv",
 "time-core",
+136 −110
Original line number Diff line number Diff line
{ lib
, stdenv

, buildEnv
, cargo
, fetchFromGitHub
, fetchYarnDeps
, installShellFiles
, lame
, mpv-unwrapped
, ninja
, nixosTests
, nodejs
, nodejs-slim
, fixup-yarn-lock
, protobuf
, python3
, qt6
, rsync
, rustPlatform
, writeShellScriptBin
, yarn

, AVKit
, CoreAudio
, swift
{
  lib,
  stdenv,

  buildEnv,
  cargo,
  fetchFromGitHub,
  fetchYarnDeps,
  installShellFiles,
  lame,
  mpv-unwrapped,
  ninja,
  nixosTests,
  nodejs,
  nodejs-slim,
  fixup-yarn-lock,
  protobuf,
  python3,
  qt6,
  rsync,
  rustPlatform,
  writeShellScriptBin,
  yarn,

  AVKit,
  CoreAudio,
  swift,
}:

let
  pname = "anki";
  version = "24.06.2";
  rev = "33a923797afc9655c3b4f79847e1705a1f998d03";
  version = "24.06.3";
  rev = "d678e39350a2d243242a69f4e22f5192b04398f2";

  src = fetchFromGitHub {
    owner = "ankitects";
    repo = "anki";
    rev = version;
    hash = "sha256-jn8MxyDPVk36neHyiuvwOQQ+x7x4JPOR8BnNutTRmnY=";
    hash = "sha256-ap8WFDDSGonk5kgXXIsADwAwd7o6Nsy6Wxsa7r1iUIM=";
    fetchSubmodules = true;
  };

@@ -50,12 +51,10 @@ let

  yarnOfflineCache = fetchYarnDeps {
    yarnLock = "${src}/yarn.lock";
    hash = "sha256-wyrVoaDdCkSe5z6C7EAw04G87s6tQ1cfc2d6ygGU0DM=";
    hash = "sha256-Dbd7RtE0td7li7oqPPfBmAsbXPM8ed9NTAhM5gytpG8=";
  };

  anki-build-python = python3.withPackages (ps: with ps; [
    mypy-protobuf
  ]);
  anki-build-python = python3.withPackages (ps: with ps; [ mypy-protobuf ]);

  # anki shells out to git to check its revision, and also to update submodules
  # We don't actually need the submodules, so we stub that out
@@ -122,7 +121,11 @@ in
python3.pkgs.buildPythonApplication {
  inherit pname version;

  outputs = [ "out" "doc" "man" ];
  outputs = [
    "out"
    "doc"
    "man"
  ];

  inherit src;

@@ -130,6 +133,8 @@ python3.pkgs.buildPythonApplication {
    ./patches/disable-auto-update.patch
    ./patches/remove-the-gl-library-workaround.patch
    ./patches/skip-formatting-python-code.patch
    # Also remove from anki/sync-server.nix on next update
    ./patches/Cargo.lock-update-time-for-rust-1.80.patch
  ];

  inherit cargoDeps yarnOfflineCache;
@@ -152,7 +157,9 @@ python3.pkgs.buildPythonApplication {
    qt6.qtsvg
  ] ++ lib.optional stdenv.isLinux qt6.qtwayland;

  propagatedBuildInputs = with python3.pkgs; [
  propagatedBuildInputs =
    with python3.pkgs;
    [
      # This rather long list came from running:
      #    grep --no-filename -oE "^[^ =]*" python/{requirements.base.txt,requirements.bundle.txt,requirements.qt6_lin.txt} | \
      #      sort | uniq | grep -v "^#$"
@@ -203,17 +210,29 @@ python3.pkgs.buildPythonApplication {
      wheel
      wrapt
      zipp
  ] ++ lib.optionals stdenv.isDarwin [
    ]
    ++ lib.optionals stdenv.isDarwin [
      AVKit
      CoreAudio
    ];

  nativeCheckInputs = with python3.pkgs; [ pytest mock astroid ];
  nativeCheckInputs = with python3.pkgs; [
    pytest
    mock
    astroid
  ];

  # tests fail with to many open files
  # TODO: verify if this is still true (I can't, no mac)
  doCheck = !stdenv.isDarwin;

  checkFlags = [
    # these two tests are flaky, see https://github.com/ankitects/anki/issues/3353
    # Also removed from anki-sync-server when removing this.
    "--skip=media::check::test::unicode_normalization"
    "--skip=scheduler::answering::test::state_application"
  ];

  dontUseNinjaInstall = false;
  dontWrapQtApps = true;

@@ -250,17 +269,22 @@ python3.pkgs.buildPythonApplication {
  '';

  # mimic https://github.com/ankitects/anki/blob/76d8807315fcc2675e7fa44d9ddf3d4608efc487/build/ninja_gen/src/python.rs#L232-L250
  checkPhase = let
    disabledTestsString = lib.pipe [
  checkPhase =
    let
      disabledTestsString =
        lib.pipe
          [
            # assumes / is not writeable, somehow fails on nix-portable brwap
            "test_create_open"
    ] [
          ]
          [
            (lib.map (test: "not ${test}"))
            (lib.concatStringsSep " and ")
            lib.escapeShellArg
          ];

  in ''
    in
    ''
      runHook preCheck
      HOME=$TMP ANKI_TEST_MODE=1 PYTHONPATH=$PYTHONPATH:$PWD/out/pylib \
        pytest -p no:cacheprovider pylib/tests -k ${disabledTestsString}
@@ -269,7 +293,6 @@ python3.pkgs.buildPythonApplication {
      runHook postCheck
    '';


  preInstall = ''
    mkdir dist
    mv out/wheels/* dist
@@ -314,7 +337,10 @@ python3.pkgs.buildPythonApplication {
    homepage = "https://apps.ankiweb.net";
    license = licenses.agpl3Plus;
    platforms = platforms.mesaPlatforms;
    maintainers = with maintainers; [ euank oxij ];
    maintainers = with maintainers; [
      euank
      oxij
    ];
    # Reported to crash at launch on darwin (as of 2.1.65)
    broken = stdenv.isDarwin;
  };
+40 −0
Original line number Diff line number Diff line
From 66d9c405bfe7cb431cc52a7aec038068b364f034 Mon Sep 17 00:00:00 2001
From: Dominique Martinet <asmadeus@codewreck.org>
Date: Sat, 10 Aug 2024 13:05:26 +0900
Subject: [PATCH] Cargo.lock: update time for rust 1.80

---
 Cargo.lock | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Cargo.lock b/Cargo.lock
index 9219317f2cea..17fb6f4a894c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -5581,9 +5581,9 @@ dependencies = [
 
 [[package]]
 name = "time"
-version = "0.3.34"
+version = "0.3.36"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749"
+checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885"
 dependencies = [
  "deranged",
  "itoa",
@@ -5602,9 +5602,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3"
 
 [[package]]
 name = "time-macros"
-version = "0.2.17"
+version = "0.2.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774"
+checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf"
 dependencies = [
  "num-conv",
  "time-core",
-- 
2.45.2
+11 −0
Original line number Diff line number Diff line
@@ -13,12 +13,23 @@ rustPlatform.buildRustPackage {
  pname = "anki-sync-server";
  inherit (anki) version src cargoLock;

  patches = [
    ./patches/Cargo.lock-update-time-for-rust-1.80.patch
  ];

  # only build sync server
  cargoBuildFlags = [
    "--bin"
    "anki-sync-server"
  ];

  checkFlags = [
    # these two tests are flaky, see https://github.com/ankitects/anki/issues/3353
    # Also removed from anki when removing this.
    "--skip=media::check::test::unicode_normalization"
    "--skip=scheduler::answering::test::state_application"
  ];

  nativeBuildInputs = [ protobuf pkg-config ];

  buildInputs = [