# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-venusian
_pkgname=venusian
pkgver=3.1.0
pkgrel=2
pkgdesc="A Python library for deferring decorator actions"
url="https://pypi.org/project/venusian"
arch="noarch"
license="BSD-4-Clause"
makedepends="py3-setuptools py3-gpep517"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

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

prepare() {
	default_prepare
	sed -i '/addopts = -W always --cov --cov-report=term-missing/d' setup.cfg
}

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

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m pytest
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
}

sha512sums="
094fe85ca1e241437c386eb4db63ed8985ba962cb7b199bb4ef903d35de885948be135715a9b39bc2a102752678d0c2aaa18e0002c7c4669fb961686b360910e  venusian-3.1.0.tar.gz
"
