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

pkgname=python-wsaccel
pkgver=0.6.6
pkgrel=3
pkgdesc='Accelerator for ws4py and AutobahnPython'
arch=('x86_64' 'aarch64')
url='https://github.com/methane/wsaccel'
license=('Apache')
depends=('python')
makedepends=('python-setuptools' 'cython' 'python-build' 'python-installer' 'python-wheel')
checkdepends=('python-pytest')
source=("https://github.com/methane/wsaccel/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('4a107db921f6f6549fb9f2f0b5c698331274171ef509136fc2d83cb6ca8bedbde32a14aaca4e38e16af3054337774dbd6aa7d8caee7866a51ded751d7d3764be')

build() {
  cd wsaccel-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd wsaccel-$pkgver
  local python_version=$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')
  PYTHONPATH="$PWD/build/lib.linux-$CARCH-cpython-$python_version" pytest
}

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