# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-cssselect2
_pyname=cssselect2
pkgver=0.8.0
pkgrel=0
pkgdesc="CSS selectors for Python ElementTree"
url="https://pypi.org/project/cssselect2/"
arch="noarch"
license="BSD-3-Clause"
depends="py3-tinycss2"
makedepends="py3-gpep517 py3-flit-core py3-installer"
checkdepends="py3-pytest"
_pypiprefix="${_pyname%${_pyname#?}}"
subpackages="$pkgname-pyc"
source="
	https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz
"
builddir="$srcdir"/$_pyname-$pkgver
options="!check" # upstream tests are broken

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
}

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

sha512sums="
fe1fbd503a8f5c06ff33856c131365f1f154610abb59c2fdef3f0e679c2421f08f9fd5e82e03f541481180551e3e0984d46243629754e8a1fa0f189743fbd23f  cssselect2-0.8.0.tar.gz
"
