# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-libusb1
pkgver=3.1.0
pkgrel=1
pkgdesc="Pure-python wrapper for libusb-1.0"
url="https://github.com/vpelletier/python-libusb1"
arch="noarch"
license="LGPL-2.1-only AND GPL-2.0-only"
depends="
	libusb
	python3
	"
makedepends="
	py3-gpep517
	py3-installer
	py3-setuptools
	py3-wheel
	"
subpackages="$pkgname-pyc"
source="https://pypi.python.org/packages/source/l/libusb1/libusb1-$pkgver.tar.gz"
builddir="$srcdir/libusb1-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	# No need to test packaging
	rm usb1/__pyinstaller/test_libusb1_packaging.py

	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m unittest discover
}

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

sha512sums="
9ee841e3d6f31e5fbebc8112f6d00ddd959a5e882515e238a84fcf5516c636198d9b84d64e39ff848c9d93c32bc5ab0d8eb6b65bb6213b4af28522fcc6b6ee99  libusb1-3.1.0.tar.gz
"
