# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=uvicorn
pkgver=0.29.0
pkgrel=1
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
	"
subpackages="$pkgname-pyc"
source="https://github.com/encode/uvicorn/archive/$pkgver/uvicorn-$pkgver.tar.gz
	httpx.patch
	"

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

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
}

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

sha512sums="
bb37940acc2eba2a649d07ba44890400332e5ad873ac03c6740c1bc730068ede39c2e6d9aefb0f100ec261d7ed2eef1596c99a060fd8000cff874b25bdbbbdfa  uvicorn-0.29.0.tar.gz
63174dbd29f2526930038454e95f74c5903fb691486bf5c9f3b6702fc7adabafe2b28a9a6ce95d1c7efa29c8e2bba08ef540e5e143fc43007b65a8e7e84936ee  httpx.patch
"
