# Maintainer: Maxime Gauduin <alucryd@archlinux.org>

pkgname=python-trio-asyncio
pkgver=0.14.0
pkgrel=1
pkgdesc='A re-implementation of the asyncio mainloop on top of Trio'
arch=(any)
url=https://github.com/python-trio/trio-asyncio
license=(
  APACHE
  MIT
)
depends=(
  python
  python-attrs
  python-exceptiongroup
  python-outcome
  python-sniffio
  python-trio
)
makedepends=(
  git
  python-build
  python-installer
  python-setuptools
  python-wheel
)
_tag=6c8b8056a3846ebafa2f4d079243baf30de964bb
source=(git+https://github.com/python-trio/trio-asyncio.git#tag=${_tag})
sha256sums=(SKIP)

prepare() {
  sed '/pytest-runner/d' -i trio-asyncio/setup.py
}

pkgver() {
  cd trio-asyncio
  git describe --tags | sed 's/^v//'
}

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

package() {
  python -m installer --destdir="${pkgdir}" trio-asyncio/dist/*.whl
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  rm -rf "${pkgdir}"${site_packages}/tests
  install -Dm 644 trio-asyncio/LICENSE -t "${pkgdir}"/usr/share/licenses/python-trio-asyncio/
  install -Dm 644 trio-asyncio/LICENSE.MIT -t "${pkgdir}"/usr/share/licenses/python-trio-asyncio/
}

# vim: ts=2 sw=2 et:
