mirror of
https://github.com/ankitects/anki.git
synced 2026-06-10 07:22:47 -04:00
migrates Anki Desktop packaging from the legacy NSIS/uv-based installer to [BeeWare Briefcase](https://briefcase.readthedocs.io/). This branch integrates work from many related issues and PRs to deliver cross-platform native installers (MSI on Windows, .app on macOS, PyInstaller on Linux) with code signing, notarization, and file association support. ## Integrated PRs - #4585 — Set up Briefcase - #4596 — Add Briefcase icons - #4598 — Handle Briefcase file associations - #4601 — Add Briefcase app permissions - #4609 — Customize Briefcase's MSI installer - #4616 — Set up Briefcase code signing and notarization - #4618 — Fix Briefcase packaging for x86 Macs - #4623 — Customize Briefcase's Linux template - #4627 — List required Debian packages for Briefcase installer - #4630 — Update Briefcase's Windows template - #4631 — Rewrite Linux install/uninstall scripts for PyInstaller - #4638 — Use PyInstaller on Linux - #4645 — Update installer docs - #4654 — Disable Briefcase's universal builds for macOS - #4672 — Deal with existing NSIS installations in MSI installer - #4676 — Remove duplicate Briefcase icons - #4677 — Tweak Linux scripts for new installer - #4709 — Add anki-console.bat to Briefcase's Windows package ## Related Issues - #4557 — Evaluate BeeWare Briefcase for Anki packaging and distribution - #4678 — Support native Windows ARM64 builds for Briefcase - #4688 — Linux installer: migrate to PyInstaller and rewrite install scripts - #4689 — Investigate startup performance with Briefcase - #4690 — Specify required Linux system packages for Briefcase - #4691 — Investigate Windows ARM64 support with Briefcase - #4692 — Test on Linux ARM with Briefcase - #4693 — Separate ARM and Intel macOS releases - #4694 — Update developer documentation for Briefcase installer - #4695 — Support upgrade/downgrade with the Briefcase installer - #4696 — Update user documentation for new installer - #4702 — Update Briefcase's Windows template with upstream security fix and OS version check - #4703 — Follow-up tweaks to Linux install/uninstall scripts ## Related PRs - #4619 — Enable Windows ARM64 support - #4632 — Release action --------- Co-authored-by: Abdo <abdo@abdnh.net> Co-authored-by: Andrew Sanchez <andrewsanchez@users.noreply.github.com> Co-authored-by: Fernando Lins <1887601+fernandolins@users.noreply.github.com>
94 lines
2.5 KiB
Python
94 lines
2.5 KiB
Python
# Copyright: Ankitects Pty Ltd and contributors
|
|
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
"""
|
|
Update commit references to the latest translations,
|
|
and copy source files to the translation repos.
|
|
|
|
Rewritten based on `./ninja ftl-sync` for CI.
|
|
"""
|
|
|
|
import os
|
|
import subprocess
|
|
from dataclasses import dataclass
|
|
|
|
|
|
@dataclass
|
|
class Module:
|
|
template_folder: str
|
|
translation_repo: str
|
|
|
|
|
|
def sync() -> None:
|
|
modules = [
|
|
Module("ftl/core", "ftl/core-repo/core"),
|
|
Module("ftl/qt", "ftl/qt-repo/desktop"),
|
|
]
|
|
check_clean()
|
|
for module in modules:
|
|
fetch_new_translations(module)
|
|
# FIXME: commented out to avoid pushing launcher.ftl for now
|
|
# push_new_templates(module)
|
|
commit(".", "Update translations")
|
|
push(".")
|
|
|
|
|
|
def check_clean() -> None:
|
|
out = subprocess.check_output(["git", "status", "--porcelain"])
|
|
if out:
|
|
raise Exception("please commit any outstanding changes first")
|
|
|
|
|
|
def fetch_new_translations(module: Module) -> None:
|
|
subprocess.check_call(["git", "checkout", "main"], cwd=module.translation_repo)
|
|
subprocess.check_call(["git", "pull", "origin", "main"], cwd=module.translation_repo)
|
|
|
|
|
|
def push_new_templates(module: Module) -> None:
|
|
subprocess.check_call(
|
|
[
|
|
"rsync",
|
|
"-ai",
|
|
"--delete",
|
|
"--no-perms",
|
|
"--no-times",
|
|
"-c",
|
|
f"{module.template_folder}/",
|
|
f"{module.translation_repo}/templates/",
|
|
]
|
|
)
|
|
changes_pending = subprocess.Popen(
|
|
["git", "diff", "--exit-code"], cwd=module.translation_repo
|
|
).wait()
|
|
if changes_pending:
|
|
commit(module.translation_repo, "Update templates")
|
|
push(module.translation_repo)
|
|
|
|
|
|
def push(repo: str) -> None:
|
|
if os.environ.get("ANKI_NO_GIT_PUSH", "0") == "1":
|
|
print("Skipping git push")
|
|
else:
|
|
subprocess.check_call(["git", "push", "origin", "main"], cwd=repo)
|
|
|
|
|
|
def commit(folder: str, message: str) -> None:
|
|
subprocess.check_call(["git", "add", "ftl/"], cwd=folder)
|
|
result = subprocess.run(
|
|
["git", "commit", "-m", message],
|
|
cwd=folder,
|
|
stdout=subprocess.PIPE,
|
|
stderr=subprocess.STDOUT,
|
|
text=True,
|
|
)
|
|
if result.returncode == 0:
|
|
return
|
|
if "nothing to commit" in result.stdout:
|
|
print(f"::notice::No changes to commit in {folder}")
|
|
else:
|
|
raise Exception(f"git commit failed in {folder}: {result.stdout}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sync()
|