# Contributor: lauren n. liberda <lauren@selfisekai.rocks>
# Maintainer: lauren n. liberda <lauren@selfisekai.rocks>
pkgname=py3-limits
pkgver=3.14.1
pkgrel=0
pkgdesc="Rate limiting using various strategies and storage backends such as redis & memcached"
url="https://github.com/alisaifee/limits"
arch="noarch"
license="MIT"
depends="
	py3-deprecated
	python3
	"
makedepends="py3-setuptools py3-gpep517"
checkdepends="
	py3-flaky
	py3-mongo
	py3-pytest
	py3-pytest-asyncio
	py3-pytest-benchmark
	py3-pytest-cov
	py3-pytest-lazy-fixtures
	py3-pymemcache
	py3-redis
	"
subpackages="$pkgname-pyc"
source="
	https://github.com/alisaifee/limits/archive/refs/tags/$pkgver/limits-$pkgver.tar.gz

	our-std-is-good-enough.patch
	tests-drop-etcd3-and-k-argument.patch
	"
builddir="$srcdir/limits-$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
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m pytest -W ignore::DeprecationWarning \
		-m 'not benchmark and not etcd and not integration and not memcached' \
		-k 'not aio and not Storage and not strategy' -v
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
}

sha512sums="
f30c7ec19c2d1edad9ed77dc590ae35717efa3956a4d97e465793e1923a4af08dc9921d90ee95d3c54ce3364b867ca67a9de62c61d627e07a3f50da20bdabd0f  limits-3.14.1.tar.gz
271e3b0501f9f144eda8d2e96c93b285714e339b9217385e38cdbce1f4dec88f9c949e9419f8be94885092e7977f7dca29b86b5499e9fead678b42a686c337db  our-std-is-good-enough.patch
e84f4db49349a6feba0f701b9d4357c5f66d64c4a23f8ce512528b0f44b5bbef55041c02d92aae3a4cc8d5340846f9e909217beb869a5aeb49df166dd29ae9e3  tests-drop-etcd3-and-k-argument.patch
"