# Contributor: Alex Denes <caskd@redxen.eu>
# Maintainer:
_pkgname=django_cors_headers
pkgname=py3-django-cors-headers
pkgver=4.6.0
pkgrel=0
pkgdesc="Django App that adds Cross-Origin Resource Sharing (CORS) headers to responses"
url="https://github.com/adamchainz/django-cors-headers"
arch="noarch"
license="MIT"
depends="
	py3-django
"
makedepends="
	py3-gpep517
	py3-setuptools_scm
	py3-wheel
	"
checkdepends="
	py3-coverage
	py3-pytest
	py3-pytest-django
	py3-pytest-randomly
"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
options="!check" # pytest-django and pytest-randomly are not on the repositories yet
builddir="$srcdir/$_pkgname-$pkgver"

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 runtests.py
}

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

sha512sums="
d5dcc7bdcaad1127109694b2e5b02185afa15a95b29547c87dfa87ab7d2efd04b6b3e2f6f4de90ba9b5736bc4720daa218f46d2ba097fae897c8480cd8c36fdd  django_cors_headers-4.6.0.tar.gz
"
