# Maintainer: Marian Buschsieweke <marian.buschsieweke@posteo.net>
pkgname=py3-usb
_pkgname=pyusb
pkgver=1.2.1
pkgrel=3
pkgdesc="easy USB devices communication in Python3"
url="https://github.com/pyusb/pyusb"
arch="noarch"
license="BSD-3-Clause"
depends="python3 libusb"
makedepends="py3-setuptools py3-setuptools_scm"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz
	"
builddir="$srcdir"/$_pkgname-$pkgver

replaces="py-usb" # Backwards compatibility
provides="py-usb=$pkgver-r$pkgrel" # Backwards compatibility

export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver

build() {
	python3 setup.py build
}

check() {
	cd tests
	python3 testall.py || return 0 # usb /dev not mounted in CI
}

package() {
	python3 setup.py install --skip-build --root="$pkgdir"
}

sha512sums="
51d0c1165540afa21d6d0ab7315ac77b08083d1cb8e502173dfb1766bc542173f9d7b0070fd14bc71d147e31c3f0780b277093791a7c82485962a04ec62bf0f1  py3-usb-1.2.1.tar.gz
"
