archrelease: copy trunk to community-any
[ArchLinux/community.git] / weechat-matrix / trunk / PKGBUILD
blob0c7e226ea7ed190099fc34f063dea4c98cf1c3b6
1 # Maintainer: Jonas Witschel <diabonas@archlinux.org>
2 pkgname=weechat-matrix
3 pkgver=0.3.0
4 _tag=ebf792a233a50d639b13e5f7c9a1c1fe988e7476 # git rev-parse "$pkgver"
5 pkgrel=10
6 pkgdesc='WeeChat Matrix protocol script written in Python'
7 arch=('any')
8 url='https://github.com/poljar/weechat-matrix'
9 license=('ISC')
10 depends=('python' 'python-atomicwrites' 'python-attrs' 'python-cachetools' 'python-logbook' 'python-matrix-nio'
11          'python-olm' 'python-peewee' 'python-pygments' 'python-pyopenssl' 'python-webcolors' 'weechat')
12 makedepends=('git' 'python-build' 'python-installer' 'python-poetry-core')
13 checkdepends=('python-hypothesis' 'python-pytest')
14 optdepends=('python-aiohttp: matrix_sso_helper support'
15             'python-magic: matrix_upload support'
16             'python-requests: matrix_decrypt and matrix_upload support'
17             'xdg-utils: default plumber for matrix_decrypt')
18 install='weechat-matrix.install'
19 source=(
20   "git+$url.git?signed#tag=$_tag"
21   0001-Switch-to-correct-build-system-definition.patch
23 sha512sums=('SKIP'
24             '65be133214b4497fead85e718d3dc57502063f4411c759d878e7132b2cb49befe5515714edda188169710c246537d893611aa8ef6faeaeab23762302e6e783b6')
25 validpgpkeys=('689A3B5BC6560AB4C99A2A0581314DA807EF4E22') # Damir Jelić (poljar) <poljar@termina.org.uk>
27 pkgver() {
28         cd "$pkgname"
29         git describe | sed 's/\([^-]*-\)g/r\1/;s/-/./g'
32 prepare() {
33         # fix PEP517 build-system definition: https://github.com/poljar/weechat-matrix/pull/340/files
34         patch -Np1 -d $pkgname -i ../0001-Switch-to-correct-build-system-definition.patch
36         cd "$pkgname"
37         sed -ri 's|#!/usr/bin/env( -S)? python3|#!/usr/bin/python3|' contrib/*.py
39         # Remove unnecessary dependency version pinning
40         sed -i 's/= "^[0-9.]*"/= "*"/' pyproject.toml
42         # SSLContext.set_npn_protocols broken in Python 3.10
43         # (https://github.com/poljar/weechat-matrix/issues/308)
44         git cherry-pick --no-commit 4e585d5f4628e6fbeba9ec4560b440d731e076f5
47 build() {
48         cd "$pkgname"
49         python -m build --wheel --no-isolation --skip-dependency-check
52 check() {
53         cd "$pkgname"
54         python -m pytest
57 package() {
58         cd "$pkgname"
59         python -m installer --destdir="$pkgdir" dist/*.whl
60         install -Dm755 main.py "$pkgdir/usr/share/weechat/python/weechat-matrix.py"
61         for _script in matrix_decrypt matrix_sso_helper matrix_upload
62         do
63                 install -Dm755 "contrib/$_script.py" "$pkgdir/usr/bin/$_script"
64         done
65         install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/$pkgname"