# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-django-allauth
_pyname="django-allauth"
pkgver=65.8.1
pkgrel=0
arch="noarch"
pkgdesc="Integrated set of Django applications addressing SSO"
url="https://pypi.python.org/project/django-allauth"
license="MIT"
# missing opt depends: python3-openid
depends="
	py3-python3-saml
	py3-qrcode
	py3-django
	py3-openid
	py3-requests
	py3-requests-oauthlib
	py3-jwt
	py3-cryptography
	py3-fido2
	"
makedepends="
	py3-setuptools
	py3-gpep517
	py3-wheel
	"
checkdepends="
	py3-pytest
	py3-pytest-django
	py3-django-rest-framework
	py3-psycopg2
	py3-yaml
	"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/pennersr/$_pyname/archive/$pkgver.tar.gz
	rollback-c99acb-skip-certain-tests.patch
	"
builddir="$srcdir"/$_pyname-$pkgver
subpackages="$pkgname-pyc"

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

	# test_security.py: requires ninja module

	case "$CARCH" in
	loongarch64)
		.testenv/bin/python3 -m pytest -v \
			--ignore="allauth/headless/contrib/ninja/tests/test_security.py" \
			--deselect allauth/socialaccount/providers/openid/tests.py::OpenIDTests::test_login \
			--deselect allauth/socialaccount/providers/openid/tests.py::OpenIDTests::test_login_with_extra_attributes
		;;
	*)
		.testenv/bin/python3 -m pytest -v \
			--ignore-glob=allauth/headless/contrib/ninja/tests/test_security.py
		;;
	esac
}

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

sha512sums="
655ff5e7cf5bb60eae6a252b6bac4e2a3dee4d507131834fddc2af3ea5ea704e9a07e9243f5987b26d718ec0bc101cc4d2b2f6e4d2b9c19eacb2c1e04879e92e  py3-django-allauth-65.8.1.tar.gz
83773454d0582d3f29025bc63e09b0bc16c17c2bc50f3ad54e66d28519be73626f537a873fa50d5b56944852ca6089a3eb57fb2f5990abf5bdf9fbcc2ac68bfc  rollback-c99acb-skip-certain-tests.patch
"
