# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>
# Maintainer: Maxime Gauduin <alucryd@archlinux.org>

pkgname=python-uvloop
pkgver=0.21.0
pkgrel=2
pkgdesc='Ultra fast asyncio event loop'
arch=(x86_64 aarch64)
url=https://github.com/MagicStack/uvloop
license=(
  APACHE
  MIT
)
depends=(
  glibc
  python
  libuv
)
makedepends=(
  cython
  git
  python-build
  python-installer
  python-setuptools
  python-wheel
)
_tag=2e8feae2a6db57bb611ffa388d28443487f4db94
source=(git+https://github.com/MagicStack/uvloop.git#tag=${_tag})
b2sums=('961a3c606edcbf0200bf8b3def9dfdee4f759dde64fb49abaf3035feead0dc444f6c5646d1ce09006abc9bcf000d640940073643d4ec681b98ac7e9c9176a113')

prepare() {
  sed 's/self.use_system_libuv = False/self.use_system_libuv = True/' -i uvloop/setup.py
  sed -e 's|>=0.29.36,<0.30.0|>=0.29.36|g' -i uvloop/pyproject.toml
}

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

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

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

# vim:set ts=2 sw=2 et:
