# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-a2wsgi
pkgver=1.10.8
pkgrel=0
pkgdesc="Convert WSGI app to ASGI app or ASGI app to WSGI app"
url="https://github.com/abersheeran/a2wsgi"
arch="noarch"
license="Apache-2.0"
depends="python3"
makedepends="py3-gpep517 py3-pdm-backend py3-wheel"
checkdepends="py3-pytest py3-httpx py3-pytest-asyncio py3-starlette"
subpackages="$pkgname-pyc"
source="https://github.com/abersheeran/a2wsgi/archive/refs/tags/v$pkgver/a2wsgi-$pkgver.tar.gz"
builddir="$srcdir/a2wsgi-$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
	.testenv/bin/python3 -m installer .dist/*.whl
	# test_baize_stream_response: baize not packaged + kinda bad
	.testenv/bin/python3 -m pytest \
		--deselect tests/test_asgi.py::test_baize_stream_response
}

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

sha512sums="
5c3ed991713c1bda8c78e71f57510b1b623aef919cfe90e8ec8a3143b6228c91810d6964960be466d670be6ddc5d571704e8704421cafb71f8f43e8120128e05  a2wsgi-1.10.8.tar.gz
"
