# Contributor: Kaarle Ritvanen <kunkku@alpinelinux.org>
# Maintainer: Kaarle Ritvanen <kunkku@alpinelinux.org>
pkgname=py3-django-sorl-thumbnail
pkgver=12.10.0
pkgrel=1
pkgdesc="Thumbnails for Django"
url="https://github.com/jazzband/sorl-thumbnail"
arch="noarch"
license="BSD-3-Clause"
depends="py3-django py3-pillow"
makedepends="py3-gpep517 py3-setuptools_scm py3-wheel"
checkdepends="imagemagick py3-pytest-django"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/s/sorl-thumbnail/sorl-thumbnail-$pkgver.tar.gz"

builddir="$srcdir/sorl-thumbnail-$pkgver"

replaces="py-django-sorl-thumbnail" # Backwards compatibility
provides="py-django-sorl-thumbnail=$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

	DJANGO_SETTINGS_MODULE=tests.settings.pil \
		.testenv/bin/python3 -m pytest
}

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

sha512sums="
4010832db9bf353558c218d427c6931f758ed9f4bd3c2936e77d1a36b85e0ae68f5e100bbc7fbed8e23372db91029d81f3acf37e0aef1e6a1b6c83d5b63674b6  sorl-thumbnail-12.10.0.tar.gz
"
