Skip to content

Instantly share code, notes, and snippets.

@escape0707
Created September 26, 2021 01:44
Show Gist options
  • Save escape0707/4c6863838895ca920ec3c3d5764591f5 to your computer and use it in GitHub Desktop.
Save escape0707/4c6863838895ca920ec3c3d5764591f5 to your computer and use it in GitHub Desktop.
anki-bin
# Maintainer: Jay Chu <tothesong@gmail.com>
_anki=anki
_aqt=aqt
_py=cp38
pkgname=anki-bin
pkgver=2.1.48
pkgrel=1
pkgdesc='Helps you remember facts (like words/phrases in a foreign language) efficiently.
Installed with wheel.'
arch=('x86_64')
url='https://apps.ankiweb.net/'
license=('AGPL3')
depends=(
# anki and aqt
'python-beautifulsoup4'
'python-requests'
# aqt
'python-flask'
'python-flask-cors'
'python-jsonschema'
'python-pyqt5'
'python-pyqtwebengine'
'python-send2trash'
'python-waitress'
# anki
'python-decorator'
'python-distro'
'python-markdown'
'python-orjson'
'python-protobuf'
'python-stringcase'
# requests
'python-pysocks'
)
makedepends=(
'python-pip'
)
optdepends=(
# 'lame: record sound'
# 'mpv: play sound. prefered over mplayer'
# 'mplayer: play sound'
)
provides=(anki=$pkgver)
conflicts=(anki)
source=(
"https://files.pythonhosted.org/packages/$_py/${_anki::1}/$_anki/$_anki-$pkgver-$_py-abi3-manylinux2014_$arch.whl"
"https://files.pythonhosted.org/packages/py3/${_aqt::1}/$_aqt/$_aqt-$pkgver-py3-none-any.whl"
"https://github.com/ankitects/anki/raw/main/qt/runanki.py"
"https://github.com/ankitects/anki/raw/main/qt/linux/anki.desktop"
"https://github.com/ankitects/anki/raw/main/qt/linux/anki.png"
)
noextract=("${source[@]##*/}")
sha256sums=('7611846cc73eceda888f342e5b6f70fb3dc651505095b6a2de42001b5b2c6d93'
'f6171546bd09097a428acc9e50a878ccfca9176eafa09bb628a8407aa227af75'
'520225521a013546c521c2c8d60db3d03d7fceb6126fa61b8a70e1d2c398e4a4'
'5121f5877cd6fe15e262317eb2ac08a01f7039e3fd5d85e3193b4b0ff7974e13'
'97ad2134ef1a7686789c7becd8bd05dd8693cf0d3127951ca6ba7b29a80b402a')
package() {
PIP_CONFIG_FILE=/dev/null pip install --isolated --root="$pkgdir" --ignore-installed --no-deps *.whl
install -Dm755 runanki.py "$pkgdir/usr/bin/anki"
install -Dm644 anki.desktop "$pkgdir/usr/share/applications/anki.desktop"
install -Dm644 anki.png "$pkgdir/usr/share/pixmaps/anki.png"
}
@Grafcube
Copy link

fcitx5 works with this package but does not work with anki-official-binary-bundle so this is actually better. Is there any reason this is not already in the AUR?

Also the SHA256 for runanki.py needs to be updated.

@escape0707
Copy link
Author

escape0707 commented Oct 21, 2021

@Grafcube This is just my first attempt for writing up a PKGBUILD, I’m not so confident about it’s correctness so I wish other people could try it out before I publish it to the AUR. Also I was planning to learn a course about cryptography before setting up my ssh key and etc.

I recently have to go to hospital several times so if you think my gist is okay, could you publish it to the AUR? I’m also okay to co-maintain it later.

@escape0707
Copy link
Author

About the raw files downloaded from the upstream repo, I think it’s better to download from a specific commit/tag of the repo if we plan to publish it on AUR. I was just using the file from the main branch for testing and tracking purpose, as I’m curious about what and why upstream will change those files.

@Grafcube
Copy link

I don't mind co-maintaining it. I only started using Arch recently so this would be the first PKGBUILD I will be maintaining. I'll read the wiki before uploading it if that's alright.

It looks very similar to other PKGBUILDs so I don't see any issues here except that it's tracking the main branch directly. I'll look into changing it.

@escape0707
Copy link
Author

Thanks for your help! As for freezing the downloaded source, it’s as easy as viewing the repo at a specific tag (for example the current release tag) and extract raw download link from there.

@Grafcube
Copy link

The package is up on the AUR. https://aur.archlinux.org/packages/anki-bin/
Can you please tell me your AUR username so I can add you as a co-maintainer.

@escape0707
Copy link
Author

username: escape0707
email: tothesong@gmail.com

@Grafcube
Copy link

All done. I installed it with paru and it worked perfectly. Thank you.

@escape0707
Copy link
Author

Thanks for your efforts, too! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment