# Contributor: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
# Maintainer: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
pkgname=py3-openant
pkgver=1.3.3
pkgrel=0
pkgdesc="Python library to communicate with ANT-FS compliant devices"
url="https://github.com/Tigge/openant"
arch="noarch"
license="MIT"
depends="python3 py3-pyserial py3-usb"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest-xdist"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/Tigge/openant/archive/v$pkgver/openant-$pkgver.tar.gz"
builddir="$srcdir/openant-$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
	.testenv/bin/python3 -m pytest -n auto
}

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

	install -Dm644 "$builddir"/resources/42-ant-usb-sticks.rules -t "$pkgdir"/usr/lib/udev/rules.d/
}

sha512sums="
ef1319cbda28b878eeeeeb5cdcb3b209929018f6e4bba38163be7a7da9a86aacde8fd719956f0939b200e8bef9788c6f5d4c78d040aa0ad08a299cd5f1a68bce  py3-openant-1.3.3.tar.gz
"
