From 67176062ace555f108ebd83cdc5db5b1372bfae7 Mon Sep 17 00:00:00 2001 From: windowsboy111 Date: Tue, 3 Jan 2023 15:36:55 +0800 Subject: [PATCH] Adding anki anki-qt5 --- anda/apps/anki-qt5/0001-Force-qt5.patch | 20 +++++++ anda/apps/anki-qt5/0001-No-update.patch | 17 ++++++ anda/apps/anki-qt5/anda.hcl | 6 +++ anda/apps/anki-qt5/anki-qt5.spec | 62 ++++++++++++++++++++++ anda/apps/anki-qt5/update.rhai | 1 + anda/apps/anki/0001-No-update.patch | 17 ++++++ anda/apps/anki/anda.hcl | 6 +++ anda/apps/anki/anki.spec | 69 +++++++++++++++++++++++++ anda/apps/anki/update.rhai | 1 + 9 files changed, 199 insertions(+) create mode 100644 anda/apps/anki-qt5/0001-Force-qt5.patch create mode 100644 anda/apps/anki-qt5/0001-No-update.patch create mode 100644 anda/apps/anki-qt5/anda.hcl create mode 100644 anda/apps/anki-qt5/anki-qt5.spec create mode 100644 anda/apps/anki-qt5/update.rhai create mode 100644 anda/apps/anki/0001-No-update.patch create mode 100644 anda/apps/anki/anda.hcl create mode 100644 anda/apps/anki/anki.spec create mode 100644 anda/apps/anki/update.rhai diff --git a/anda/apps/anki-qt5/0001-Force-qt5.patch b/anda/apps/anki-qt5/0001-Force-qt5.patch new file mode 100644 index 0000000000..586a70e2b4 --- /dev/null +++ b/anda/apps/anki-qt5/0001-Force-qt5.patch @@ -0,0 +1,20 @@ +diff -uNr anki-2.1.55.old/qt/aqt/qt/__init__.py anki-2.1.55/qt/aqt/qt/__init__.py +--- anki-2.1.55.old/qt/aqt/qt/__init__.py 2023-01-02 18:34:13.716216913 +0800 ++++ anki-2.1.55/qt/aqt/qt/__init__.py 2023-01-02 18:34:00.410033708 +0800 +@@ -9,16 +9,7 @@ + import traceback + from typing import Callable, TypeVar, Union + +-try: +- import PyQt6 +-except: +- from .qt5 import * # type: ignore +-else: +- if not os.getenv("DISABLE_QT5_COMPAT"): +- print("Running with temporary Qt5 compatibility shims.") +- print("Run with DISABLE_QT5_COMPAT=1 to confirm compatibility with Qt6.") +- from . import qt5_compat # needs to be imported first +- from .qt6 import * ++from .qt5 import * # type: ignore + + from anki.utils import is_mac, is_win diff --git a/anda/apps/anki-qt5/0001-No-update.patch b/anda/apps/anki-qt5/0001-No-update.patch new file mode 100644 index 0000000000..578c19f79b --- /dev/null +++ b/anda/apps/anki-qt5/0001-No-update.patch @@ -0,0 +1,17 @@ +diff -uNr anki-2.1.55.old/qt/aqt/profiles.py anki-2.1.55/qt/aqt/profiles.py +--- anki-2.1.55.old/qt/aqt/profiles.py 2023-01-02 18:35:44.574467892 +0800 ++++ anki-2.1.55/qt/aqt/profiles.py 2023-01-02 18:34:00.412033736 +0800 +@@ -77,11 +77,11 @@ + + metaConf = dict( + ver=0, +- updates=True, ++ updates=False, + created=int_time(), + id=random.randrange(0, 2**63), + lastMsg=-1, +- suppressUpdate=False, ++ suppressUpdate=True, + firstRun=True, + defaultLang=None, + ) diff --git a/anda/apps/anki-qt5/anda.hcl b/anda/apps/anki-qt5/anda.hcl new file mode 100644 index 0000000000..d404d7d176 --- /dev/null +++ b/anda/apps/anki-qt5/anda.hcl @@ -0,0 +1,6 @@ +project "pkg" { + rpm { + spec = "anki-qt5.spec" + update = "" + } +} diff --git a/anda/apps/anki-qt5/anki-qt5.spec b/anda/apps/anki-qt5/anki-qt5.spec new file mode 100644 index 0000000000..7181e08817 --- /dev/null +++ b/anda/apps/anki-qt5/anki-qt5.spec @@ -0,0 +1,62 @@ +Name: anki-qt5 +Version: 2.1.55 +Release: %autorelease +Summary: Flashcard program for using space repetition learning +License: AGPLv3+ and GPLv3+ and LGPLv3 and MIT and BSD and ASL 2.0 and CC-BY-SA and CC-BY +URL: https://apps.ankiweb.net/ +BuildRequires: python3-devel python3-setuptools python3-beautifulsoup4 python3-waitress python3-decorator python3-markdown python3-protobuf python3-pysocks +BuildRequires: python3-distro python3-flask-cors python3-jsonschema python3-requests python3-send2trash python3-certifi python3-pyqt5-sip python3-simplejson +BuildRequires: desktop-file-utils libappstream-glib python3-installer make xdg-utils +BuildRequires: cargo git rsync ninja-build libxcrypt-compat nodejs python3.9 python-unversioned-command +Requires: hicolor-icon-theme python3-sqlalchemy python3-simplejson python3-matplotlib python3-decorator python3-markdown python3-send2trash +Requires: python3-requests python3-pygame python3-beautifulsoup4 python3-httplib2 python3-pyaudio python3-jsonschema sox libxcrypt-compat +ExclusiveArch: %{qt5_qtwebengine_arches} noarch +Patch0: 0001-Force-qt5.patch +Patch1: 0001-No-update.patch +BuildArch: noarch +Conflicts: anki + +%description +Anki is a program designed to help you remember facts (such as words +and phrases in a foreign language) as easily, quickly and efficiently +as possible. Anki is based on a theory called spaced repetition. + +%prep +git clone https://github.com/ankitects/anki . +git checkout %{version} +%patch0 -p1 +%patch1 -p1 + +# See https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=anki + +%build +./tools/build + +%install +for file in out/wheels/*.whl; do + python -m installer --destdir="%{buildroot}" $file +done + +install -Dm644 qt/bundle/lin/anki.desktop %{buildroot}/%{_datadir}/applications/anki.desktop +install -Dm644 qt/bundle/lin/anki.png %{buildroot}/%{_datadir}/pixmaps/anki.png + +sed "s*^#!/usr/bin/python\$*#!/usr/bin/python3*" %{buildroot}/%{_bindir}/anki > %{buildroot}/%{_bindir}/anki + + +%files +%license LICENSE* +%doc README* +%{_bindir}/anki +%{_datadir}/applications/anki.desktop +/usr/lib64/python*/site-packages/aqt/ +/usr/lib64/python*/site-packages/aqt-%{version}.dist-info/ +/usr/lib64/python*/site-packages/_aqt/ +/usr/lib64/python*/site-packages/_aqt-%{version}.dist-info/ +/usr/lib64/python*/site-packages/anki/ +/usr/lib64/python*/site-packages/anki-%{version}.dist-info/ +/usr/share/pixmaps/anki.png + + +%changelog +* Tue Jan 3 2023 windowsboy111 +- Initial package diff --git a/anda/apps/anki-qt5/update.rhai b/anda/apps/anki-qt5/update.rhai new file mode 100644 index 0000000000..06eb9c5883 --- /dev/null +++ b/anda/apps/anki-qt5/update.rhai @@ -0,0 +1 @@ +rpm.version(gh("ankitects/anki")); diff --git a/anda/apps/anki/0001-No-update.patch b/anda/apps/anki/0001-No-update.patch new file mode 100644 index 0000000000..578c19f79b --- /dev/null +++ b/anda/apps/anki/0001-No-update.patch @@ -0,0 +1,17 @@ +diff -uNr anki-2.1.55.old/qt/aqt/profiles.py anki-2.1.55/qt/aqt/profiles.py +--- anki-2.1.55.old/qt/aqt/profiles.py 2023-01-02 18:35:44.574467892 +0800 ++++ anki-2.1.55/qt/aqt/profiles.py 2023-01-02 18:34:00.412033736 +0800 +@@ -77,11 +77,11 @@ + + metaConf = dict( + ver=0, +- updates=True, ++ updates=False, + created=int_time(), + id=random.randrange(0, 2**63), + lastMsg=-1, +- suppressUpdate=False, ++ suppressUpdate=True, + firstRun=True, + defaultLang=None, + ) diff --git a/anda/apps/anki/anda.hcl b/anda/apps/anki/anda.hcl new file mode 100644 index 0000000000..1eef41fad6 --- /dev/null +++ b/anda/apps/anki/anda.hcl @@ -0,0 +1,6 @@ +project "pkg" { + rpm { + spec = "anki.spec" + update = "" + } +} diff --git a/anda/apps/anki/anki.spec b/anda/apps/anki/anki.spec new file mode 100644 index 0000000000..cf78dc6904 --- /dev/null +++ b/anda/apps/anki/anki.spec @@ -0,0 +1,69 @@ +Name: anki +Version: 2.1.55 +Release: %autorelease +Summary: Flashcard program for using space repetition learning +License: AGPLv3+ and GPLv3+ and LGPLv3 and MIT and BSD and ASL 2.0 and CC-BY-SA and CC-BY +URL: https://apps.ankiweb.net/ +BuildRequires: python3-devel python3-setuptools python3-beautifulsoup4 python3-waitress python3-decorator python3-markdown python3-protobuf python3-pysocks +BuildRequires: python3-distro python3-flask-cors python3-jsonschema python3-requests python3-send2trash python3-certifi python3-pyqt5-sip python3-simplejson +BuildRequires: desktop-file-utils libappstream-glib python3-installer make xdg-utils mold +BuildRequires: cargo git rsync ninja-build libxcrypt-compat nodejs python3.9 python-unversioned-command +Requires: hicolor-icon-theme python3-sqlalchemy python3-simplejson python3-matplotlib python3-decorator python3-markdown python3-send2trash +Requires: python3-requests python3-pygame python3-beautifulsoup4 python3-httplib2 python3-pyaudio python3-jsonschema sox libxcrypt-compat +BuildArch: noarch +ExclusiveArch: %{qt6_qtwebengine_arches} noarch +Conflicts: anki-qt5 +Patch0: 0001-No-update.patch + +%description +Anki is a program designed to help you remember facts (such as words +and phrases in a foreign language) as easily, quickly and efficiently +as possible. Anki is based on a theory called spaced repetition. + +%prep +git clone https://github.com/ankitects/anki . +git checkout %{version} +%patch0 -p1 +%patch1 -p1 + +cat > .cargo/config.toml << EOF +[target.x86_64-unknown-linux-gnu] +rustflags = ["-C", "link-arg=-fuse-ld=/usr/bin/mold"] +EOF + +# See https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=anki + +%build +./tools/build + +%install +for file in out/wheels/*.whl; do + python -m installer --destdir="%{buildroot}" $file +done + +install -Dm644 qt/bundle/lin/anki.desktop %{buildroot}/%{_datadir}/applications/anki.desktop +install -Dm644 qt/bundle/lin/anki.png %{buildroot}/%{_datadir}/pixmaps/anki.png + +sed "s*^#!/usr/bin/python\$*#!/usr/bin/python3*" %{buildroot}/%{_bindir}/anki > %{buildroot}/%{_bindir}/anki + +find %{buildroot} -iname __pycache__ | xargs -r rm -rf +find %{buildroot} -iname direct_url.json | xargs -r rm -rf + + +%files +%license LICENSE* +%doc README* +%{_bindir}/anki +%{_datadir}/applications/anki.desktop +/usr/lib64/python*/site-packages/aqt/ +/usr/lib64/python*/site-packages/aqt-%{version}.dist-info/ +/usr/lib64/python*/site-packages/_aqt/ +/usr/lib64/python*/site-packages/_aqt-%{version}.dist-info/ +/usr/lib64/python*/site-packages/anki/ +/usr/lib64/python*/site-packages/anki-%{version}.dist-info/ +/usr/share/pixmaps/anki.png + + +%changelog +* Tue Jan 3 2023 windowsboy111 +- Initial package diff --git a/anda/apps/anki/update.rhai b/anda/apps/anki/update.rhai new file mode 100644 index 0000000000..06eb9c5883 --- /dev/null +++ b/anda/apps/anki/update.rhai @@ -0,0 +1 @@ +rpm.version(gh("ankitects/anki"));