# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=py3-typeguard
_pkgname=typeguard
pkgver=4.4.1
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="
af862371b22237cc39efad4840bb0bbd632116bee6e095531426dbaff606b6c1b2b58c82ddc083f816c340b4151421ff911ffd689dc3dc2fb7a031c067182aba  typeguard-4.4.1.tar.gz
"
