# Contributor: Justin Berthault <justin.berthault@zaclys.net>
# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=py3-asttokens
pkgver=3.0.0
pkgrel=0
pkgdesc="Annotate AST trees with source code positions"
url="https://github.com/gristlabs/asttokens"
arch="noarch"
license="Apache-2.0"
depends="python3"
makedepends="py3-gpep517 py3-setuptools_scm py3-wheel"
checkdepends="py3-astroid py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/a/asttokens/asttokens-$pkgver.tar.gz"

builddir="$srcdir/"asttokens-$pkgver

build() {
	export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
	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

	case "$CARCH" in
	s390x)
		.testenv/bin/python3 -m pytest \
			--deselect tests/test_mark_tokens.py::TestMarkTokens::test_deep_recursion
		;;
	*)
		.testenv/bin/python3 -m pytest
		;;
	esac
}

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

sha512sums="
e4cab19517597c446043eab8e8eddd192fc4743dadf338720733f9dd1647829310a01386c2345a346ab242cabceb3454832ea5671cb252f434c59e3866460157  asttokens-3.0.0.tar.gz
"
