# Contributor: Peter Shkenev <santurysim@gmail.com>
# Maintainer: Peter Shkenev <santurysim@gmail.com>
pkgname=gajim
pkgver=1.9.3
pkgrel=0
_pkgver_suffix=""
pkgdesc="A full featured and easy to use XMPP client"
url="https://gajim.org/"
arch="noarch"
license="GPL-3.0-only"
depends="
	dbus
	gtk+3.0
	gtksourceview4
	libsoup3
	py3-cairo
	py3-css-parser
	py3-emoji
	py3-gobject3
	py3-keyring
	py3-nbxmpp
	py3-omemo-dr
	py3-openssl
	py3-packaging
	py3-pillow
	py3-precis-i18n
	py3-qrcode
	py3-sqlalchemy
	sqlite
	pango
	"
makedepends="
	gettext-dev
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
checkdepends="xvfb-run font-dejavu py3-pytest"
source="
	https://gajim.org/downloads/${pkgver:0:3}/gajim-$pkgver$_pkgver_suffix.tar.gz
	disable-test.patch
	"
subpackages="$pkgname-doc $pkgname-lang $pkgname-pyc"

build() {
	./pep517build/build_metadata.py -o .dist/metadata
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	xvfb-run -a .testenv/bin/python3 -m pytest #unittest discover -s test
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
	./pep517build/install_metadata.py .dist/metadata --prefix="$pkgdir"/usr
}

lang() {
	pkgdesc="Languages for package $pkgname"
	amove usr/lib/python3*/site-packages/gajim/data/locale
}

sha512sums="
d7815ad77afb3ea1e7b1cdf6baa4ed1acaaed857da4a0ca1db57200dc3fc7103e4110ee8b7e2918838f86c9250226a6c8b98be6cd0915ea29eaf5e1a2830688a  gajim-1.9.3.tar.gz
228ec0c9a92e88861888d64a5077f19a6b87b1e29f712c5db23601add69406c0ef0e865780db6b1deaae28397969978869dde18704cc0bbb5a37f8ef564760f7  disable-test.patch
"
