# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=py3-dbus-fast
pkgver=2.24.4
pkgrel=0
pkgdesc="A faster version of dbus-next"
url="https://github.com/bluetooth-devices/dbus-fast/"
arch="all"
license="MIT"
depends="
	dbus
	python3
	"
makedepends="
	cython
	poetry
	python3-dev
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-pytest
	py3-pytest-asyncio
	py3-pytest-cov
	py3-pytest-timeout
	"
subpackages="$pkgname-doc $pkgname-pyc"
source="py3-dbus-fast-$pkgver.tar.gz::https://github.com/bluetooth-devices/dbus-fast/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/dbus-fast-$pkgver"

build() {
	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

	dbus-run-session -- .testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl

	install -Dm644 README.md -t "$pkgdir"/usr/share/doc/$pkgname
}

sha512sums="
e08a1b8c028cf33f7055621b502ffdffb1d9c79875b9f9d05afca401cdc583ae97bb029706002ad0e94e2ce8ccf3a992fe9cc9c023e87f64d04bb581b2e9f263  py3-dbus-fast-2.24.4.tar.gz
"
