# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-queuelib
_pkgname=queuelib
pkgver=1.7.0
pkgrel=0
pkgdesc="A collection of persistent (disk-based) queues"
url="https://github.com/scrapy/queuelib"
arch="noarch"
license="BSD-3-Clause"
makedepends="py3-setuptools py3-gpep517 py3-wheel"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

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

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
}

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

sha512sums="
051406a2a53642ac9d01dd56cec60bc937457862a9ebf35957dcebd1c754993cc0a50668a92160bc886884f5787c90a825bdc2e8b1091885040f7c0d76a80ae0  queuelib-1.7.0.tar.gz
"
