summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Löthberg2021-09-18 00:31:28 +0200
committerJohannes Löthberg2021-09-18 00:31:28 +0200
commit1d26f6662e2eae0e2283a80558807ce791fc1328 (patch)
treedc0ade887b98cc8fca32a4aadc4f0ddc9168885f
parente27887def594545651b3b0f8b923a0bc1b905e17 (diff)
downloadaur-1d26f6662e2eae0e2283a80558807ce791fc1328.tar.gz
Import from community
Dropping since they completely redid the build system yet again, but this time replaced it with bazel, which appears to be a rather unreasonable build system that no other TU seemed to understand either.
-rw-r--r--.SRCINFO62
-rw-r--r--0001-Move-aqt_data-to-sys.prefix-share.patch45
-rw-r--r--0002-Remove-bad-build-steps-from-makefiles.patch94
-rw-r--r--0003-Compile-.py-s-before-building-wheel.patch43
-rw-r--r--0004-Disable-auto-updates.patch29
-rw-r--r--0005-Make-pyenv-target-just-create-venv.patch45
-rw-r--r--PKGBUILD142
7 files changed, 413 insertions, 47 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 3fc48da0b393..054e2ca29042 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,25 +1,55 @@
pkgbase = anki
- pkgdesc = Friendly, intelligent flash cards
- pkgver = 2.1.0beta3
- pkgrel = 1
+ pkgdesc = Helps you remember facts (like words/phrases in a foreign language) efficiently
+ pkgver = 2.1.35
+ pkgrel = 3
url = https://ankisrs.net/
- arch = any
+ arch = x86_64
license = AGPL3
- checkdepends = python-nose
- checkdepends = python-coverage
- checkdepends = texlive-core
- depends = python-pyqt5
- depends = python-pyaudio
- depends = python-requests
+ makedepends = git
+ makedepends = rsync
+ makedepends = maturin
+ makedepends = rust
+ makedepends = python-pip
+ makedepends = python-mypy-protobuf
+ makedepends = npm
+ makedepends = typescript
depends = python-beautifulsoup4
+ depends = python-requests
+ depends = python-wheel
+ depends = python-pysocks
+ depends = python-decorator
+ depends = python-protobuf
+ depends = python-orjson
+ depends = python-distro
depends = python-send2trash
- depends = python-httplib2
- depends = qt5-webengine
+ depends = python-markdown
+ depends = python-jsonschema
+ depends = python-pyaudio
+ depends = python-pyqtwebengine
+ depends = python-flask
+ depends = python-flask-cors
+ depends = python-waitress
+ depends = python-pyqt5
optdepends = lame: record sound
+ optdepends = mpv: play sound. prefered over mplayer
optdepends = mplayer: play sound
- optdepends = texlive-core: use latex markup
- source = https://apps.ankiweb.net/downloads/beta/anki-2.1.0beta3-source.tgz
- sha512sums = d901effa5fac10a337f7073cc9ded2319b1c6677981439d013a46cf48c88ddc4b7f2c3af43c052c69f01aadbcebb647157e030a0d7e4e855f080525576698e9c
+ source = git+https://github.com/ankitects/anki.git#commit=84dcaa86380f9491c5f6240418235f87180831f7
+ source = ankitects-anki-core-i18n-aefd745.tar.gz::https://github.com/ankitects/anki-core-i18n/tarball/aefd745
+ source = ankitects-anki-desktop-ftl-51320cd.tar.gz::https://github.com/ankitects/anki-desktop-ftl/tarball/51320cd
+ source = ankitects-anki-desktop-i18n-67b07d5.tar.gz::https://github.com/ankitects/anki-desktop-i18n/tarball/67b07d5
+ source = 0001-Move-aqt_data-to-sys.prefix-share.patch
+ source = 0002-Remove-bad-build-steps-from-makefiles.patch
+ source = 0003-Compile-.py-s-before-building-wheel.patch
+ source = 0004-Disable-auto-updates.patch
+ source = 0005-Make-pyenv-target-just-create-venv.patch
+ sha256sums = SKIP
+ sha256sums = 36693fda3bb4515aa4832017155e6055e6063912bc7d62c918d1e0b3aaf8d424
+ sha256sums = 30a8739badea5e2d8be263c2595e25534863d8d2af23608689ebface6a64787b
+ sha256sums = 6500f5483d6121e9f07b64fac1bd00800107b01a353b8e15024ed30b773a26f1
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = SKIP
pkgname = anki
-
diff --git a/0001-Move-aqt_data-to-sys.prefix-share.patch b/0001-Move-aqt_data-to-sys.prefix-share.patch
new file mode 100644
index 000000000000..3c73464724fd
--- /dev/null
+++ b/0001-Move-aqt_data-to-sys.prefix-share.patch
@@ -0,0 +1,45 @@
+From 71c4f41d5408731496abe294ce202160b7f3912c Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Johannes=20L=C3=B6thberg?= <johannes@kyriasis.com>
+Date: Sun, 29 Mar 2020 06:24:43 +0200
+Subject: [PATCH 1/5] 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@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 b9a2983b..f97c5f19 100644
+--- a/qt/aqt/utils.py
++++ b/qt/aqt/utils.py
+@@ -24,7 +24,7 @@ if TYPE_CHECKING:
+
+ 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 831532e0..da243f9b 100644
+--- a/qt/setup.py
++++ b/qt/setup.py
+@@ -8,7 +8,7 @@ import setuptools
+ 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.29.2
+
diff --git a/0002-Remove-bad-build-steps-from-makefiles.patch b/0002-Remove-bad-build-steps-from-makefiles.patch
new file mode 100644
index 000000000000..2a347e969d98
--- /dev/null
+++ b/0002-Remove-bad-build-steps-from-makefiles.patch
@@ -0,0 +1,94 @@
+From 2f3da2ef25943d468d6d992589979f1c92f3fb92 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Johannes=20L=C3=B6thberg?= <johannes@kyriasis.com>
+Date: Sun, 29 Mar 2020 05:54:00 +0200
+Subject: [PATCH 2/5] Remove bad build steps from makefiles
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
+---
+ Makefile | 2 +-
+ pylib/Makefile | 4 ++--
+ qt/Makefile | 2 +-
+ rslib/Makefile | 2 +-
+ rspy/Makefile | 2 +-
+ 5 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index d99e115a..cffa2e30 100644
+--- a/Makefile
++++ b/Makefile
+@@ -90,7 +90,7 @@ buildhash:
+ fi
+
+ .PHONY: develop
+-develop: pyenv buildhash prepare
++develop: pyenv buildhash
+ @set -eu -o pipefail ${SHELLFLAGS}; \
+ . "${ACTIVATE_SCRIPT}"; \
+ for dir in $(DEVEL); do \
+diff --git a/pylib/Makefile b/pylib/Makefile
+index 5cb14e09..8d8388c3 100644
+--- a/pylib/Makefile
++++ b/pylib/Makefile
+@@ -41,7 +41,7 @@ all: check
+
+ PROTODEPS := ../proto/backend.proto ../proto/fluent.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
+@@ -54,7 +54,7 @@ PROTODEPS := ../proto/backend.proto ../proto/fluent.proto
+ python -m black -t py36 anki/hooks.py
+ @touch $@
+
+-BUILD_STEPS := .build/vernum .build/run-deps .build/dev-deps anki/buildinfo.py .build/py-proto .build/hooks
++BUILD_STEPS := .build/vernum .build/run-deps .build/dev-deps anki/buildinfo.py .build/py-proto
+
+ # Checking
+ ######################
+diff --git a/qt/Makefile b/qt/Makefile
+index 4fc6b482..b50d1868 100644
+--- a/qt/Makefile
++++ b/qt/Makefile
+@@ -64,7 +64,7 @@ TSDEPS := $(wildcard ts/src/*.ts) $(wildcard ts/scss/*.scss)
+ python -m black aqt/gui_hooks.py
+ @touch $@
+
+-BUILD_STEPS := .build/vernum .build/run-deps .build/dev-deps .build/js .build/ui aqt/buildinfo.py .build/hooks .build/i18n
++BUILD_STEPS := .build/vernum .build/js .build/ui aqt/buildinfo.py .build/i18n
+
+ # Checking
+ ######################
+diff --git a/rslib/Makefile b/rslib/Makefile
+index 7a18b53e..aa42c712 100644
+--- a/rslib/Makefile
++++ b/rslib/Makefile
+@@ -25,7 +25,7 @@ fix:
+ clean:
+ rm -rf .build target
+
+-develop: .build/vernum ftl/repo
++develop: .build/vernum
+
+ ftl/repo:
+ (cd ftl && ./scripts/fetch-latest-translations)
+diff --git a/rspy/Makefile b/rspy/Makefile
+index 5eb9ea8f..ed401be9 100644
+--- a/rspy/Makefile
++++ b/rspy/Makefile
+@@ -52,7 +52,7 @@ all: develop
+
+ develop: .build/develop
+
+-DEPS := .build/tools .build/vernum ../meta/buildhash \
++DEPS := .build/vernum ../meta/buildhash \
+ $(wildcard $(QT_FTL_TEMPLATES)/*.ftl) \
+ $(wildcard $(QT_FTL_LOCALES)/*/*.ftl) \
+ $(shell "${FIND}" ../rslib/src -name '*.rs' -or -name '*.sql') $(wildcard ../proto/*) \
+--
+2.29.2
+
diff --git a/0003-Compile-.py-s-before-building-wheel.patch b/0003-Compile-.py-s-before-building-wheel.patch
new file mode 100644
index 000000000000..98ed8720a09e
--- /dev/null
+++ b/0003-Compile-.py-s-before-building-wheel.patch
@@ -0,0 +1,43 @@
+From 251f15df8ca3419b0cc92f6196f23b1186ff12bc Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Johannes=20L=C3=B6thberg?= <johannes@kyriasis.com>
+Date: Mon, 4 May 2020 18:46:38 +0200
+Subject: [PATCH 3/5] Compile .py's before building wheel
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
+---
+ pylib/Makefile | 2 ++
+ qt/Makefile | 2 ++
+ 2 files changed, 4 insertions(+)
+
+diff --git a/pylib/Makefile b/pylib/Makefile
+index 8d8388c3..78480c0c 100644
+--- a/pylib/Makefile
++++ b/pylib/Makefile
+@@ -105,6 +105,8 @@ build: .build/build
+
+ .build/build: $(BUILD_STEPS) $(CHECKDEPS)
+ rm -rf dist build
++ python setup.py build
++ python -O -m compileall .
+ python setup.py -q bdist_wheel
+ rsync -a dist/*.whl ../dist/
+ touch $@
+diff --git a/qt/Makefile b/qt/Makefile
+index b50d1868..acf50d6e 100644
+--- a/qt/Makefile
++++ b/qt/Makefile
+@@ -137,6 +137,8 @@ build: .build/build
+ .build/build: $(BUILD_STEPS) $(CHECKDEPS) $(wildcard ../ts/dist/*)
+ rm -rf dist build
+ rsync -a ../ts/dist/ aqt_data/web/
++ python setup.py build
++ python -O -m compileall .
+ python setup.py -q bdist_wheel
+ rsync -a dist/*.whl ../dist/
+ touch $@
+--
+2.29.2
+
diff --git a/0004-Disable-auto-updates.patch b/0004-Disable-auto-updates.patch
new file mode 100644
index 000000000000..d2c14c44d5ac
--- /dev/null
+++ b/0004-Disable-auto-updates.patch
@@ -0,0 +1,29 @@
+From bd0d5b6fde2ff0d3ca2fe8a6bdf59ce6e0fa1058 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Johannes=20L=C3=B6thberg?= <johannes@kyriasis.com>
+Date: Mon, 4 May 2020 17:57:29 +0200
+Subject: [PATCH 4/5] Disable auto updates
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
+---
+ qt/aqt/update.py | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/qt/aqt/update.py b/qt/aqt/update.py
+index 8b179f65..a46618b8 100644
+--- a/qt/aqt/update.py
++++ b/qt/aqt/update.py
+@@ -33,6 +33,8 @@ class LatestVersionFinder(QThread):
+ }
+
+ def run(self):
++ return
++
+ if not self.config["updates"]:
+ return
+ d = self._data()
+--
+2.29.2
+
diff --git a/0005-Make-pyenv-target-just-create-venv.patch b/0005-Make-pyenv-target-just-create-venv.patch
new file mode 100644
index 000000000000..7f10676fa98c
--- /dev/null
+++ b/0005-Make-pyenv-target-just-create-venv.patch
@@ -0,0 +1,45 @@
+From 894a3e04560ca11651016ede480fb372e8a2d45b Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Johannes=20L=C3=B6thberg?= <johannes@kyriasis.com>
+Date: Sat, 7 Nov 2020 17:01:04 +0100
+Subject: [PATCH 5/5] Make pyenv target just create venv
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
+---
+ Makefile | 18 +-----------------
+ 1 file changed, 1 insertion(+), 17 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index cffa2e30..d7233235 100644
+--- a/Makefile
++++ b/Makefile
+@@ -61,23 +61,7 @@ all: run
+ # - modern pip required for wheel
+ # - add qt if missing
+ pyenv:
+-# https://github.com/PyO3/maturin/issues/283 - Expected `python` to be a python interpreter inside a virtualenv
+- set -eu -o pipefail ${SHELLFLAGS}; \
+- "${PYTHON_BIN}" -m venv pyenv; \
+- case "$$(uname -s)" in CYGWIN*|MINGW*|MSYS*) \
+- dos2unix "${ACTIVATE_SCRIPT}"; \
+- VIRTUAL_ENV="$$(pwd)"; \
+- VIRTUAL_ENV="$$(cygpath -m "$${VIRTUAL_ENV}")"; \
+- sed -i -- "s@VIRTUAL_ENV=\".*\"@VIRTUAL_ENV=\"$$(pwd)/pyenv\"@g" "${ACTIVATE_SCRIPT}"; \
+- sed -i -- "s@export PATH@export PATH; VIRTUAL_ENV=\"$${VIRTUAL_ENV}/pyenv\";@g" "${ACTIVATE_SCRIPT}"; \
+- ;; esac; \
+- . "${ACTIVATE_SCRIPT}"; \
+- python --version; \
+- python -m pip install --upgrade pip setuptools; \
+- ${ANKI_EXTRA_PIP}; \
+- if ! python -c 'import PyQt5' 2>/dev/null; then \
+- python -m pip install -r qt/requirements.qt; \
+- fi;
++ python -m venv pyenv --system-site-packages
+
+ # update build hash
+ .PHONY: buildhash
+--
+2.29.2
+
diff --git a/PKGBUILD b/PKGBUILD
index e8d93f17a877..af2e8d7462d7 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,41 +1,121 @@
-# Maintainer: Wes Barnett <wes at wbarnett dot us>
+# Maintainer: Johannes Löthberg <johannes@kyriasis.com>
+# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
+# Contributor: Timm Preetz <timm@preetz.us>
+# Contributor: Michael 'manveru' Fellinger <m.fellinger@gmail.com>
+# Contributor: Dave Pretty <david dot pretty at gmail dot com>
+
+_core_i18n=aefd745
+_desktop_ftl=51320cd
+_desktop_i18n=67b07d5
+
pkgname=anki
-pkgver=2.1.0beta3
-pkgrel=1
-pkgdesc="Friendly, intelligent flash cards"
+pkgver=2.1.35
+pkgrel=3
+
+pkgdesc="Helps you remember facts (like words/phrases in a foreign language) efficiently"
url="https://ankisrs.net/"
+arch=('x86_64')
license=('AGPL3')
-arch=('any')
-depends=('python-pyqt5' 'python-pyaudio' 'python-requests' 'python-beautifulsoup4'
-'python-send2trash' 'python-httplib2' 'qt5-webengine')
-checkdepends=('python-nose' 'python-coverage' 'texlive-core')
-optdepends=('lame: record sound'
- 'mplayer: play sound'
- 'texlive-core: use latex markup')
-source=(https://apps.ankiweb.net/downloads/beta/$pkgname-$pkgver-source.tgz)
-sha512sums=('d901effa5fac10a337f7073cc9ded2319b1c6677981439d013a46cf48c88ddc4b7f2c3af43c052c69f01aadbcebb647157e030a0d7e4e855f080525576698e9c')
-build() {
- cd $srcdir/$pkgname-$pkgver
- ./tools/build_ui.sh
+depends=(
+ # anki and aqt
+ 'python-beautifulsoup4'
+ 'python-requests'
+ 'python-wheel'
+
+ # anki
+ 'python-pysocks' # requests[socks]
+ 'python-decorator'
+ 'python-protobuf'
+ 'python-orjson'
+ 'python-distro'
+
+ # aqt
+ 'python-send2trash'
+ 'python-markdown'
+ 'python-jsonschema'
+ 'python-pyaudio'
+ 'python-pyqtwebengine'
+ 'python-flask'
+ 'python-flask-cors'
+ 'python-waitress'
+ 'python-pyqt5'
+)
+makedepends=(
+ 'git'
+ 'rsync'
+
+ 'maturin'
+ 'rust'
+
+ 'python-pip'
+ 'python-mypy-protobuf'
+ 'npm'
+ 'typescript'
+)
+optdepends=(
+ 'lame: record sound'
+ 'mpv: play sound. prefered over mplayer'
+ 'mplayer: play sound'
+)
+
+source=(
+ git+https://github.com/ankitects/anki.git#commit=84dcaa86380f9491c5f6240418235f87180831f7
+
+ ankitects-anki-core-i18n-$_core_i18n.tar.gz::https://github.com/ankitects/anki-core-i18n/tarball/$_core_i18n
+ ankitects-anki-desktop-ftl-$_desktop_ftl.tar.gz::https://github.com/ankitects/anki-desktop-ftl/tarball/$_desktop_ftl
+ ankitects-anki-desktop-i18n-$_desktop_i18n.tar.gz::https://github.com/ankitects/anki-desktop-i18n/tarball/$_desktop_i18n
+
+ 0001-Move-aqt_data-to-sys.prefix-share.patch
+ 0002-Remove-bad-build-steps-from-makefiles.patch
+ 0003-Compile-.py-s-before-building-wheel.patch
+ 0004-Disable-auto-updates.patch
+ 0005-Make-pyenv-target-just-create-venv.patch
+)
+sha256sums=('SKIP'
+ '36693fda3bb4515aa4832017155e6055e6063912bc7d62c918d1e0b3aaf8d424'
+ '30a8739badea5e2d8be263c2595e25534863d8d2af23608689ebface6a64787b'
+ '6500f5483d6121e9f07b64fac1bd00800107b01a353b8e15024ed30b773a26f1'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP'
+ 'SKIP')
+
+prepare() {
+ cd anki
+ patch -p1 <"$srcdir"/0001-Move-aqt_data-to-sys.prefix-share.patch
+ patch -p1 <"$srcdir"/0002-Remove-bad-build-steps-from-makefiles.patch
+ patch -p1 <"$srcdir"/0003-Compile-.py-s-before-building-wheel.patch
+ patch -p1 <"$srcdir"/0004-Disable-auto-updates.patch
+ patch -p1 <"$srcdir"/0005-Make-pyenv-target-just-create-venv.patch
+
+ # Put translations in place.
+ ln -sf "$srcdir"/ankitects-anki-core-i18n-*/ rslib/ftl/repo
+ ln -sf "$srcdir"/ankitects-anki-desktop-ftl-*/ qt/ftl/repo
+ ln -sf "$srcdir"/ankitects-anki-desktop-i18n-*/ qt/po/repo
}
-check() {
- cd $srcdir/$pkgname-$pkgver
- coverage=1 ./tools/tests.sh
+build() {
+ cd anki
+
+ # Built into the shared libraries so that the Python component can check
+ # that it has the same value.
+ echo arch-linux-$pkgver-$pkgrel > meta/buildhash
+
+ # Installs development modules in venv, which is required by scripts used
+ # by various make targets. The dependencies between targets are completely broken.
+ make develop
+
+ make build
}
package() {
- cd $srcdir/$pkgname-$pkgver
- install -Dm755 tools/runanki.system $pkgdir/usr/bin/anki
- install -Dm644 anki.xpm anki.png -t $pkgdir/usr/share/pixmaps/
- install -Dm644 anki.desktop -t $pkgdir/usr/share/applications/
- install -Dm644 anki.1 -t $pkgdir/usr/share/man/man1/
- install -Dm644 README.md -t $pkgdir/usr/share/doc/anki/
- install -Dm644 LICENSE -t $pkgdir/usr/share/licenses/anki/
- mkdir -p $pkgdir/usr/share/anki
- cp -ar anki $pkgdir/usr/share/anki/
- cp -ar aqt $pkgdir/usr/share/anki/
- cp -ar designer $pkgdir/usr/share/anki/
- cp -ar locale $pkgdir/usr/share/anki/
+ cd anki
+
+ 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
+ install -Dm644 qt/anki.png "$pkgdir"/usr/share/pixmaps/anki.png
}