# Contributor: Oleg Titov <oleg.titov@gmail.com>
# Maintainer: Oleg Titov <oleg.titov@gmail.com>
pkgname=py3-dbus-fast
pkgver=2.44.1
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-codspeed
	py3-pytest-cov
	py3-pytest-covdefaults
	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"
	install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/"$pkgname"

}

sha512sums="
8db8d0748b09ffbe3040f3fae8938236dd23a326a0f0995868319c74152db4968ffa6b43f8efd950f8dbc4e850c17ffb7d474bc3f429935680f76a3e96bfd522  py3-dbus-fast-2.44.1.tar.gz
"
