maintainer="Michał Polański <michal@polanski.me>"
pkgname=uvicorn
pkgver=0.32.0
pkgrel=0
pkgdesc="Lightning-fast ASGI server"
url="https://www.uvicorn.org/"
license="BSD-3-Clause"
# disable due to lack of support for websockets 14
# https://gitlab.alpinelinux.org/alpine/aports/-/issues/16646
arch=""
depends="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-typing-extensions
	py3-watchfiles
	py3-websockets
	py3-wsproto
	py3-yaml
	"
subpackages="$pkgname-pyc"
source="https://github.com/encode/uvicorn/archive/$pkgver/uvicorn-$pkgver.tar.gz
	test_multiprocess.patch
	"

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
	.testenv/bin/python3 -m pytest \
		-k "not test_close_connection_with_multiple_requests" # a known issue
}

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

sha512sums="
66bfaf0ff37507b90fa63d4a9d3cdb8ae7aa70629ad9bcf52a391abd2c85e67cfce066ba8fb39d9e8f7781bdbad52a03ac9beb9cdbc91af59c29bcf2654ba8b0  uvicorn-0.32.0.tar.gz
cfad91dd84f8974362f52d754d7a29f09d07927a46acaa0eb490b6115a5729d84d6df94fead10ccd4cce7f5ea376f1348b0f59daede661dd8373a3851c313c46  test_multiprocess.patch
"
