# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Steven Guikal <void@fluix.one>
pkgname=py3-dbus-next
pkgver=0.2.3
pkgrel=6
pkgdesc="DBus library with asyncio support"
url="https://github.com/altdesktop/python-dbus-next"
arch="noarch"
license="MIT"
depends="python3"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	dbus
	py3-pytest
	py3-pytest-asyncio
	py3-pytest-timeout
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/altdesktop/python-dbus-next/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/python-dbus-next-$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

	# Run test_disconnect/marshaller separately so tests pass on Py 3.12
	dbus-run-session -- .testenv/bin/python3 -m pytest \
		-k 'not test_tcp_connection_with_forwarding' \
		--ignore test/test_disconnect.py \
		--ignore test/test_marshaller.py
	dbus-run-session -- .testenv/bin/python3 -m pytest \
		test/test_disconnect.py \
		test/test_marshaller.py
}

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

sha512sums="
7836d855c755c8ac6cbbb251ca0cbd2f4df9b573f31b1ea1cab480e47896d36b4cb0d479b2469b0bf0b5c700068361a18874b4a087f73020cdcb4e04a2d7dbe7  py3-dbus-next-0.2.3.tar.gz
"
