# Maintainer: Carl Smedstad <carsme@archlinux.org>

pkgname=python-quart-trio
_pkgname=${pkgname#python-}
pkgver=0.12.0
pkgrel=1
pkgdesc="Extension for Quart to support the Trio event loop"
url=https://github.com/pgjones/quart-trio
arch=(any)
license=(MIT)
depends=(
  hypercorn
  python
  python-quart
  python-trio
  python-werkzeug
)
makedepends=(
  python-build
  python-installer
  python-pdm-backend
  python-wheel
)
checkdepends=(
  python-pytest
  python-pytest-trio
)
source=("$url/archive/$pkgver/$_pkgname-$pkgver.tar.gz")
sha256sums=('9062eef2a4b0f29089bed4d56d635280fda79f0f45a32e2e7073bbe78c795924')

build() {
  cd "$_pkgname-$pkgver"
  python -m build --wheel --no-isolation
}

check() {
  cd "$_pkgname-$pkgver"
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  test-env/bin/python -m pytest --override-ini="addopts="
}

package() {
  cd "$_pkgname-$pkgver"
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}
