# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Maintainer: Will Sinatra <wpsinatra@gmail.com>
pkgname=py3-django-js-asset
_pkgname=django-js-asset
pkgver=2.2
pkgrel=2
pkgdesc="script tag with additional attributes for django.forms.Media"
url="https://github.com/matthiask/django-js-asset"
arch="noarch"
license="BSD-3-Clause"
depends="py3-django"
makedepends="
	py3-gpep517
	py3-hatchling
	py3-wheel
	"
checkdepends="py3-pytest py3-coverage"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/matthiask/$_pkgname/archive/$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver
options="!check" # need more setup

replaces="py-django-js-asset" # Backwards compatibility
provides="py-django-js-asset=$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 -m pytest
}

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

sha512sums="
d35f8f1b83726826e9092e7d33dc22d5b53df9f6c1a6a141d7928dfa9eaada3d13a5879b2ee65825b73a2b048e4d21528d462c6449a87d4c0b599501811a40fe  py3-django-js-asset-2.2.tar.gz
"
