# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=py3-decorator
_pkgname=decorator
pkgver=5.2.1
pkgrel=0
pkgdesc="Python3 Decorator module"
url="https://github.com/micheles/decorator"
arch="noarch"
license="BSD-2-Clause"
depends="python3"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
subpackages="$pkgname-pyc"
source="https://github.com/micheles/decorator/archive/refs/tags/$pkgver/py3-decorator-$pkgver.tar.gz"
builddir="$srcdir/$_pkgname-$pkgver"

replaces="py-decorator" # Backwards compatibility
provides="py-decorator=$pkgver-r$pkgrel" # Backwards compatibility

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 tests/test.py -v
}

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

sha512sums="
2e4d8e79aef229eb9620352dd0d8a938d7353261aa955085880638acc34d88c310143fbf3e0f3518d3ad764975249fb7282dce27f748ef03228de7cc6e461c4b  py3-decorator-5.2.1.tar.gz
"
