# Maintainer: Maxime Gauduin <alucryd@archlinux.org>
# Contributor: Felix Yan <felixonmars@archlinux.org>

pkgname=python-pyjwt
pkgver=2.12.1
pkgrel=1
pkgdesc='JSON Web Token implementation in Python'
arch=(any)
url=https://github.com/jpadilla/pyjwt
license=(MIT)
depends=(python)
makedepends=(
  git
  python-build
  python-installer
  python-setuptools
  python-wheel
)
checkdepends=(
  python-cryptography
  python-pytest
)
_tag=a4e1a3d1218b01c5806420b8f16d9308ac4adc30
source=(git+https://github.com/jpadilla/pyjwt.git#tag=${_tag})
b2sums=('9bd30a52709b2647ea1b7d5349fa2df596176668b0b87916b946408e2b01ded79c18f690e1463711d0033bdf10bc7c1450c8cd42ad0bddd8862a541db56e62bd')

pkgver() {
  cd pyjwt
  git describe --tags
}

build() {
  cd pyjwt
  python -m build -wn
}

check() {
  cd pyjwt

  python -m installer -d test_dir dist/*.whl

  local _site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  PYTHONPATH="test_dir/$_site_packages:$PYTHONPATH" pytest
}

package() {
  python -m installer -d "${pkgdir}" pyjwt/dist/*.whl
  install -Dm 644 pyjwt/LICENSE -t "${pkgdir}"/usr/share/licenses/python-pyjwt/
}

# vim: ts=2 sw=2 et:
