# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=py3-pebble
pkgver=5.1.1
pkgrel=0
pkgdesc="Multi threading and processing eye-candy"
url="https://github.com/noxdafox/pebble"
arch="noarch"
license="LGPL-3.0-or-later"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-pytest-forked
	py3-pytest-xdist
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/noxdafox/pebble/archive/refs/tags/$pkgver.tar.gz"
builddir="$srcdir/pebble-$pkgver"

case "$CARCH" in
	# Tests timeout in CI
	ppc64le) options="$options !check" ;;
	riscv64) options="$options !check" ;;
	# Some tests fail on s390x, but it otherwise appears to work.
	s390x)   options="$options !check" ;;
esac

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 --forked
}

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

sha512sums="
67093980e19e8c36c5c665c9a686fb91a91743fce5f7a134d110bfc9e88268e3cfffa5adbd3427b9a2c41dc370f10fc9b05813185b3b7e59042659a2d2ed7d47  py3-pebble-5.1.1.tar.gz
"
