# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Anatol Pomozov

pkgname=python-txaio
# https://github.com/crossbario/txaio/blob/master/docs/releases.rst
pkgver=25.12.2
pkgrel=1
pkgdesc='Compatibility API between asyncio/Twisted/Trollius'
arch=('any')
url="https://github.com/crossbario/txaio"
license=('MIT')
depends=('python')
makedepends=('git' 'python-build' 'python-installer' 'python-hatchling')
# python-tests is used here:
# https://github.com/crossbario/txaio/blob/v20.1.1/test/_asyncio_test_utils.py#L35
checkdepends=('python-pytest' 'python-twisted' 'python-tests')
optdepends=(
  'python-twisted: Twisted support'
  'python-zope-interface: Twisted support'
)
source=("git+https://github.com/crossbario/txaio.git#tag=v$pkgver")
sha512sums=('1b5201e01b78f3ae4a81c4246e4817d16ad7f31a67432968f24d226baa4e0a1b18763650cdceecd8a609023ddc10bb9196d676b955fe2e372ac314a3b3ab0567')

build() {
  cd "$srcdir"/txaio
  python -m build --wheel --no-isolation
}

check() {
  cd "$srcdir"/txaio
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  test-env/bin/python -m pytest -v
}

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