# Contributor: prspkt <prspkt@protonmail.com>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=py3-importlib-resources
pkgver=6.1.1
pkgrel=1
pkgdesc="Backport of the importlib.resources module"
url="https://github.com/python/importlib_resources"
arch="noarch"
license="Apache-2.0"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-setuptools_scm
	py3-wheel
	"
checkdepends="
	py3-pytest
	py3-zipp
	"
subpackages="$pkgname-pyc"
source="https://pypi.python.org/packages/source/i/importlib_resources/importlib_resources-$pkgver.tar.gz"
options="!check" # Fails to find import 'test'
builddir="$srcdir/importlib_resources-$pkgver"

export SETUPTOOLS_SCM_PRETEND_VERSION="$pkgver"

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="
4d16891b81ef0257da3df8db930f3c823af5ed9f01907ee278bf7b8e78c887ab1d88dcfda4b70c648bbb4a92449727140e7b255d5d92458233ce55570d624d81  importlib_resources-6.1.1.tar.gz
"
