[arch-commits] Commit in anki/trunk (3 files)

Johannes Löthberg demize at archlinux.org
Sun Mar 29 12:26:45 UTC 2020


    Date: Sunday, March 29, 2020 @ 12:26:44
  Author: demize
Revision: 605885

upgpkg: anki 2.1.23-1

Added:
  anki/trunk/0001-Move-aqt_data-to-sys.prefix-share.patch
  anki/trunk/0001-Unfuck-make-build-targets.patch
Modified:
  anki/trunk/PKGBUILD

----------------------------------------------+
 0001-Move-aqt_data-to-sys.prefix-share.patch |   45 +++++++++++
 0001-Unfuck-make-build-targets.patch         |   93 +++++++++++++++++++++++
 PKGBUILD                                     |  101 +++++++++++++++++++++----
 3 files changed, 226 insertions(+), 13 deletions(-)

Added: 0001-Move-aqt_data-to-sys.prefix-share.patch
===================================================================
--- 0001-Move-aqt_data-to-sys.prefix-share.patch	                        (rev 0)
+++ 0001-Move-aqt_data-to-sys.prefix-share.patch	2020-03-29 12:26:44 UTC (rev 605885)
@@ -0,0 +1,45 @@
+From d7ecae49a8a46e5ad5f25726044a25006fd1f006 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Johannes=20L=C3=B6thberg?= <johannes at kyriasis.com>
+Date: Sun, 29 Mar 2020 06:24:43 +0200
+Subject: [PATCH] Move aqt_data to sys.prefix/share
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+These files do _not_ belong right under sys.prefix.
+
+Signed-off-by: Johannes Löthberg <johannes at kyriasis.com>
+---
+ qt/aqt/utils.py | 2 +-
+ qt/setup.py     | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/qt/aqt/utils.py b/qt/aqt/utils.py
+index a0e12362..4d8c8c34 100644
+--- a/qt/aqt/utils.py
++++ b/qt/aqt/utils.py
+@@ -21,7 +21,7 @@ from aqt.theme import theme_manager
+ 
+ def aqt_data_folder() -> str:
+     # wheel install?
+-    dir = os.path.join(sys.prefix, "aqt_data")
++    dir = os.path.join(sys.prefix,"share", "aqt_data")
+     if not os.path.exists(dir) or not os.listdir(dir):
+         # running in place?
+         dir = os.path.join(os.path.dirname(__file__), "..", "aqt_data")
+diff --git a/qt/setup.py b/qt/setup.py
+index 6d498994..d67a8791 100644
+--- a/qt/setup.py
++++ b/qt/setup.py
+@@ -9,7 +9,7 @@ with open("../meta/version") as fh:
+ def package_files(directory):
+     entries = []
+     for (path, directories, filenames) in os.walk(directory):
+-        entries.append((path, [os.path.join(path, f) for f in filenames]))
++        entries.append((os.path.join("share", path), [os.path.join(path, f) for f in filenames]))
+     return entries
+ 
+ 
+-- 
+2.26.0
+

Added: 0001-Unfuck-make-build-targets.patch
===================================================================
--- 0001-Unfuck-make-build-targets.patch	                        (rev 0)
+++ 0001-Unfuck-make-build-targets.patch	2020-03-29 12:26:44 UTC (rev 605885)
@@ -0,0 +1,93 @@
+From 3dc54977a9cc86175bf47b3586178c3d86ad53d5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Johannes=20L=C3=B6thberg?= <johannes at kyriasis.com>
+Date: Sun, 29 Mar 2020 05:54:00 +0200
+Subject: [PATCH] Unfuck make build targets
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Johannes Löthberg <johannes at kyriasis.com>
+---
+ pylib/Makefile | 12 ++----------
+ qt/Makefile    | 10 +---------
+ rspy/Makefile  |  4 ----
+ 3 files changed, 3 insertions(+), 23 deletions(-)
+
+diff --git a/pylib/Makefile b/pylib/Makefile
+index 9727fc92..1d86144e 100644
+--- a/pylib/Makefile
++++ b/pylib/Makefile
+@@ -31,17 +31,9 @@ $(shell mkdir -p .build ../dist)
+ PHONY: all
+ all: check
+ 
+-.build/run-deps: setup.py
+-	python -m pip install -e .
+-	@touch $@
+-
+-.build/dev-deps: requirements.dev
+-	python -m pip install -r requirements.dev
+-	@touch $@
+-
+ PROTODEPS := $(wildcard ../proto/*.proto)
+ 
+-.build/py-proto: .build/dev-deps $(PROTODEPS)
++.build/py-proto: $(PROTODEPS)
+ 	protoc --proto_path=../proto --python_out=anki --mypy_out=anki $(PROTODEPS)
+ 	perl -i'' -pe 's/from fluent_pb2/from anki.fluent_pb2/' anki/backend_pb2.pyi
+ 	perl -i'' -pe 's/import fluent_pb2/import anki.fluent_pb2/' anki/backend_pb2.py
+@@ -52,7 +44,7 @@ PROTODEPS := $(wildcard ../proto/*.proto)
+ 	python -m black anki/hooks.py
+ 	@touch $@
+ 
+-BUILD_STEPS := .build/run-deps .build/dev-deps .build/py-proto anki/buildinfo.py .build/hooks
++BUILD_STEPS := .build/py-proto anki/buildinfo.py
+ 
+ # Checking
+ ######################
+diff --git a/qt/Makefile b/qt/Makefile
+index 4fef3e92..562a18a2 100644
+--- a/qt/Makefile
++++ b/qt/Makefile
+@@ -34,14 +34,6 @@ $(shell mkdir -p .build ../dist)
+ PHONY: all
+ all: check
+ 
+-.build/run-deps: setup.py
+-	python -m pip install -e .
+-	@touch $@
+-
+-.build/dev-deps: requirements.dev
+-	python -m pip install -r requirements.dev
+-	@touch $@
+-
+ .build/ui: $(shell ${FIND} designer -type f)
+ 	./tools/build_ui.sh
+ 	@touch $@
+@@ -64,7 +56,7 @@ TSDEPS := $(wildcard ts/src/*.ts) $(wildcard ts/scss/*.scss)
+ 	python -m black aqt/gui_hooks.py
+ 	@touch $@
+ 
+-BUILD_STEPS := .build/run-deps .build/dev-deps .build/js .build/ui aqt/buildinfo.py .build/hooks .build/i18n
++BUILD_STEPS := .build/js .build/ui aqt/buildinfo.py .build/i18n
+ 
+ # Checking
+ ######################
+diff --git a/rspy/Makefile b/rspy/Makefile
+index 20362e17..c31636ea 100644
+--- a/rspy/Makefile
++++ b/rspy/Makefile
+@@ -78,10 +78,6 @@ clean:
+ RUST_TOOLCHAIN := $(shell cat rust-toolchain)
+ 
+ .build/tools: requirements.txt rust-toolchain
+-	python -m pip install -r requirements.txt
+-	rustup toolchain install $(RUST_TOOLCHAIN)
+-	rustup component add rustfmt-preview --toolchain $(RUST_TOOLCHAIN)
+-	rustup component add clippy-preview --toolchain $(RUST_TOOLCHAIN)
+ 	@touch $@
+ 
+ .build/check: build
+-- 
+2.26.0
+

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-03-29 12:17:49 UTC (rev 605884)
+++ PKGBUILD	2020-03-29 12:26:44 UTC (rev 605885)
@@ -5,27 +5,102 @@
 # Contributor: Dave Pretty <david dot pretty at gmail dot com>
 
 pkgname=anki
-pkgver=2.1.15
+pkgver=2.1.23
 pkgrel=1
 
 pkgdesc="Helps you remember facts (like words/phrases in a foreign language) efficiently"
 url="https://ankisrs.net/"
-arch=('any')
+arch=('x86_64')
 license=('AGPL3')
 
-depends=('qt5-webengine' 'python-beautifulsoup4' 'python-pyaudio'
-         'python-pyqt5' 'python-pyqtwebengine' 'python-requests' 'python-send2trash'
-         'python-decorator' 'python-markdown' 'python-jsonschema' 'python-distro'
-         'desktop-file-utils')
-optdepends=('lame: record sound'
-            'mpv: play sound. prefered over mplayer'
-            'mplayer: play sound')
+depends=(
+	# anki and aqt
+	'python-beautifulsoup4'
+	'python-requests'
+	'python-wheel'
 
-source=(https://apps.ankiweb.net/downloads/current/anki-$pkgver-source.tgz)
-sha256sums=('5a53760164c77d619f55107a13099cffe620566a7f610b61b6c4b52487f3bb89')
+	# anki
+	'python-decorator'
+	'python-distro'
+	# Currently not packaged.  Falls back to stdlib json module.
+	# 'python-orjson'
+	'python-protobuf'
 
+	# aqt
+	'python-jsonschema'
+	'python-markdown'
+	'python-pyaudio'
+	'python-pyqt5'
+	'python-pyqtwebengine'
+	'python-send2trash'
+)
+makedepends=(
+	'git'
+	'rsync'
+
+	'maturin'
+	'rustup'
+
+	'python-pip'
+	'python-mypy-protobuf'
+	'npm'
+	'typescript'
+)
+optdepends=(
+	'lame: record sound'
+	'mpv: play sound. prefered over mplayer'
+	'mplayer: play sound'
+)
+
+source=(
+	anki-$pkgver.tar.gz::https://github.com/ankitects/anki/archive/$pkgver.tar.gz
+	git+https://github.com/ankitects/anki-desktop-ftl#commit=255a12eadf5c6afc22705ac9ab7c9e2982c7d2b1
+	git+https://github.com/ankitects/anki-core-i18n#commit=23c4dc5bf5c88c782536ec48934ef6a379b10e72
+	0001-Unfuck-make-build-targets.patch
+	0001-Move-aqt_data-to-sys.prefix-share.patch
+)
+sha256sums=(
+	'682efd4cf044a89a0dbd83e30d4545683c6574d847642cc64cc0e0ca4a94f4ae'
+	'SKIP'
+	'SKIP'
+	'SKIP'
+	'SKIP'
+)
+
+prepare() {
+	cd anki-$pkgver
+	patch -p1 <"$srcdir"/0001-Unfuck-make-build-targets.patch
+	patch -p1 <"$srcdir"/0001-Move-aqt_data-to-sys.prefix-share.patch
+}
+
+build() {
+	# Put translations in place.
+	git clone anki-desktop-ftl anki-$pkgver/qt/ftl/repo
+	git clone anki-core-i18n anki-$pkgver/rslib/ftl/repo
+
+	# Built into the shared libraries so that the Python component can check
+	# that it has the same value.
+	cd anki-$pkgver/meta
+	echo anki-$pkgver > buildhash
+
+	# rust ankirspy module
+	cd ../rspy
+	make build
+
+	# python anki module
+	cd ../pylib
+	make build
+
+	# python aqt module
+	cd ../qt
+	make build
+}
+
 package() {
-  cd anki-$pkgver
+	cd anki-$pkgver
 
-  make DESTDIR="$pkgdir" PREFIX=/usr install
+	PIP_CONFIG_FILE=/dev/null pip install --isolated --root="$pkgdir" --ignore-installed --no-deps dist/*.whl
+
+	install -Dm755 qt/runanki "$pkgdir"/usr/bin/anki
+	install -Dm644 qt/anki.desktop "$pkgdir"/usr/share/applications/anki.desktop
 }



More information about the arch-commits mailing list