# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=uvicorn
pkgver=0.22.0
pkgrel=0
pkgdesc="Lightning-fast ASGI server"
url="https://www.uvicorn.org/"
license="BSD-3-Clause"
arch="noarch"
depends="
	python3
	py3-asgiref
	py3-click
	py3-h11
	"
makedepends="py3-gpep517 py3-hatchling"
checkdepends="
	py3-a2wsgi
	py3-dotenv
	py3-httptools
	py3-httpx
	py3-pytest
	py3-pytest-mock
	py3-trustme
	py3-watchfiles
	py3-websockets
	py3-wsproto
	py3-yaml
	"
options="!check" # Missing dependency for tests
subpackages="$pkgname-pyc"
source="https://github.com/encode/uvicorn/archive/$pkgver/uvicorn-$pkgver.tar.gz"

case "$CARCH" in
	# test suite blocked by py3-httpx
	armhf|ppc64le) options="!check" ;;
	# test failures
	aarch64) options="!check" ;;
esac

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	pytest
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/uvicorn-$pkgver-py3-none-any.whl
}

sha512sums="
61af2df426a5bc060a32730ddf024ca8dd39ccea6800235bf48d7e0c694b9d363cbedd826f498063c6779061af84b6b56e8ab0a466e74291dbbaf5ae995e5587  uvicorn-0.22.0.tar.gz
"
