# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Contributor: Steven Guikal <void@fluix.one>
# Maintainer: Steven Guikal <void@fluix.one>
pkgname=py3-flask-login
_pkgname=flask-login
pkgver=0.6.3
pkgrel=1
pkgdesc="Flask user session management"
url="https://github.com/maxcountryman/flask-login"
arch="noarch"
license="MIT"
depends="
	py3-flask
	py3-werkzeug
	"
makedepends="
	py3-gpep517
	py3-setuptools
	py3-wheel
	"
checkdepends="
	py3-asgiref
	py3-blinker
	py3-pytest
	py3-semantic-version
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/maxcountryman/flask-login/archive/$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

replaces="py-flask-login" # Backwards compatibility
provides="py-flask-login=$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
	# These rely on internal properties of Werkzeug < 2.3
	.testenv/bin/python3 -m pytest -W ignore::DeprecationWarning \
		--deselect "tests/test_login.py::LoginTestCase::test_remember_me_accepts_duration_as_int" \
		--deselect "tests/test_login.py::LoginTestCase::test_remember_me_custom_duration_uses_custom_cookie" \
		--deselect "tests/test_login.py::LoginTestCase::test_remember_me_refresh_every_request" \
		--deselect "tests/test_login.py::LoginTestCase::test_remember_me_uses_custom_cookie_parameters"
}

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

sha512sums="
c421f85387b9ba0ba2ad98053cae596dd9bf6119c0a366d2b13c483d4fbf45afc0c0e4d46f35368f42fa088398ace9a0a0aab931826d8612d94f55b95afef71b  py3-flask-login-0.6.3.tar.gz
"
