# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>
# Maintainer: Maxime Gauduin <alucryd@archlinux.org>

pkgname=python-uvloop
pkgver=0.19.0
pkgrel=5
pkgdesc='Ultra fast asyncio event loop'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
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=6c770dc3fbdd281d15c2ad46588c139696f9269c
source=(git+https://github.com/MagicStack/uvloop.git#tag=${_tag}
        cython3.patch)
b2sums=('56c45089a5cdae9bd25adb75357ae748ebb60e19cd26ce11b24bcdcb8c700c52a881959cb0aeaeb2c2d65c2667764a2a8f4ef521ab24c8b75d523d4c43ae1593'
        '8fca88bd34eaa0233340e1aa05a27ec9b98c52a8dd6fcf741b19d5d5057dfa5ec9d3758d120e2a3f643a269dee4330568c288f63f0065b8a8b10aac5e2a752f5')

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
  patch -d uvloop -p1 < cython3.patch
}

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:
