# Contributor: Leonardo Arena <rnalrd@alpinelinux.org>
# Contributor: Justin Berthault <justin.berthault@zaclys.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-django-rest-framework
_pkgname=django-rest-framework
pkgver=3.16.0
pkgrel=0
pkgdesc="Web APIs for Django"
url="https://github.com/encode/django-rest-framework"
arch="noarch"
license="Custom"
depends="
	py3-django
	py3-tz
"
makedepends="
	py3-setuptools
	py3-gpep517
	py3-wheel
"
checkdepends="
	py3-pytest-django
	py3-pytest-cov
	py3-core-api
	py3-jinja2
	py3-uritemplate
	py3-django-guardian
	py3-psycopg2
	py3-markdown
	py3-yaml
	py3-inflection
"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/encode/$_pkgname/archive/$pkgver.tar.gz"
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 "$builddir"/.dist/*.whl
	# test_urlpatterns: AssertionError: assert [<URLPattern ''>] is not [<URLPattern ''>]
	# test_markdown: rather hard to decipher assertion error
	# test_shell_code_example_rendering: passes locally
	.testenv/bin/python3 -m pytest -v -k 'not test_urlpatterns and not test_markdown and not test_shell_code_example_rendering'
}

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

sha512sums="
60df1226a18f833c3f79f103cc13df06d72438862272e59d875bddbbefb7bc737b13ca92458c3e0a624f18f9ab5ecd2f035bcc515416a5aaf5b5b680d973fb77  py3-django-rest-framework-3.16.0.tar.gz
"
