# Contributor: Marian Buschsieweke <marian.buschsieweke@posteo.net>
# Maintainer: Marian Buschsieweke <marian.buschsieweke@posteo.net>
pkgname=py3-riotctrl
pkgver=0.5.0
pkgrel=4
pkgdesc="python object abstraction of a RIOT device"
url="https://github.com/RIOT-OS/riotctrl"
arch="noarch"
license="MIT"
depends="
	py3-pexpect
	py3-psutil
	py3-rapidjson
	python3
	"
makedepends="
	py3-setuptools
	py3-gpep517
	"
checkdepends="
	py3-pytest
	py3-pytest-cov
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/RIOT-OS/riotctrl/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/"riotctrl-$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
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m pytest \
		--deselect riotctrl/tests/ctrl_test.py::test_riotctrl_application_dir \
		--deselect riotctrl/tests/ctrl_test.py::test_riotctrl_curdir \
		--deselect riotctrl/tests/shell_json_test.py::test_rapid_json_shell_interaction_parser_wo_rapidjson \
		--deselect riotctrl/tests/ctrl_test.py::test_running_term_with_reset
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl

	rm -r "$pkgdir"/usr/lib/python3*/site-packages/riotctrl/tests
}

sha512sums="
95caf93c8594fc56f0b9bfa8eccd4bdbccaa223d963961c11ae54eeb842690ae9c7b88c4ef6892ddfdc0fa7e23804c41c460073b5e608c978c80ae48c9d5eafd  py3-riotctrl-0.5.0.tar.gz
"
