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

pkgname=python-nest-asyncio
pkgver=1.6.0
pkgrel=4
pkgdesc="Patch asyncio to allow nested event loops"
url="https://github.com/erdewit/nest_asyncio"
license=('BSD-2-Clause')
arch=('any')
depends=('python')
makedepends=('git' 'python-setuptools-scm' 'python-setuptools' 'python-build' 'python-installer' 'python-wheel')
provides=('python-nest_asyncio')
replaces=('python-nest_asyncio')
source=("git+https://github.com/erdewit/nest_asyncio.git#tag=v$pkgver")
sha512sums=('b85ca536a8a1fb47af09a30b0084034860bd483249e22e0d452966383bd5108138096a94ea03bd529a07b719b8f4f15bcb05892e2dfc399f47f1fcce74940b12')

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

check() {
  cd nest_asyncio
  PYTHONPATH="$PWD/build/lib" python tests/nest_test.py
}

package() {
  cd nest_asyncio
  python -m installer --destdir="$pkgdir" dist/*.whl

  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
