# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Maxime Gauduin <alucryd@archlinux.org>

pkgname=hypercorn
pkgver=0.17.3
pkgrel=2
pkgdesc='An ASGI Server based on Hyper libraries and inspired by Gunicorn'
url=https://github.com/pgjones/hypercorn
arch=(any)
license=(MIT)
depends=(
  python
  python-h11
  python-h2
  python-priority
  python-wsproto
)
makedepends=(
  git
  python-build
  python-installer
  python-poetry-core
)
checkdepends=(
  python-distlib
  python-hypothesis
  python-httpx
  python-pytest
  python-pytest-asyncio
  python-pytest-sugar
  python-pytest-trio
  python-trio
)
optdepends=('python-trio: trio support')
_tag=c405deafb22d66587ea0aff4f8fa4f5688b74351
source=(git+https://github.com/pgjones/hypercorn.git#tag=${_tag})
sha256sums=('8702202c855ae5e8978a36eee7d6bc3cb5fdeb795351e53672a4f3d4445152f7')

pkgver() {
  cd hypercorn
  git describe --tags
}

build() {
  cd hypercorn
  python -m build --wheel --no-isolation
}

check() {
  cd hypercorn
  PYTHONPATH="src:$PYTHONPATH" pytest \
    --override-ini="addopts=" \
    --ignore=tests/trio/test_lifespan.py
}

package() {
  python -m installer --destdir="${pkgdir}" hypercorn/dist/*.whl
  install -Dm 644 hypercorn/LICENSE -t "${pkgdir}"/usr/share/licenses/hypercorn/
}

# vim: ts=2 sw=2 et:
