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

pkgname=python-priority
pkgver=2.0.0
pkgrel=7
pkgdesc='A pure-Python implementation of the HTTP/2 priority tree'
arch=('any')
license=('MIT')
url='https://github.com/python-hyper/priority'
depends=('python')
makedepends=('python-setuptools' 'python-build' 'python-installer' 'python-wheel')
checkdepends=('python-pytest' 'python-hypothesis')
source=("https://github.com/python-hyper/priority/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('be22788a76049a8822f5a307f2b00948ac0555d0b6dd629686de90de482295806d071d1731bcdbfdc0f98abbb5aba7d2e947f478b479b72580e7ce1d19d684bb')

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

check() {
  cd priority-$pkgver
  PYTHONPATH="$PWD"/src pytest
}

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

  # Symlink license file
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  install -d "$pkgdir"/usr/share/licenses/$pkgname
  ln -s "$site_packages"/priority-$pkgver.dist-info/LICENSE \
    "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

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