# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=py3-typeguard
_pkgname=typeguard
pkgver=4.4.2
pkgrel=0
pkgdesc="run-time type checker for Python "
url="https://typeguard.readthedocs.io/"
arch="noarch"
license="MIT"
depends="py3-bracex py3-typing-extensions" # TODO: remove py3-typing-extensions once python>3.12
makedepends="py3-gpep517 py3-setuptools_scm py3-wheel"
checkdepends="py3-mypy py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

build() {
	SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver \
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	rm -f tests/mypy/test_type_annotations.py # test is broken
	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="
205429ae4960563c10b747956a2f4f41504abb300957cc75be0e9a6caecba84bebbbbf2e71d22f2961870f12f29e03fcd78ef0cd54edd7285f62ceaf35a74138  typeguard-4.4.2.tar.gz
"
