# Maintainer: Bruno Pagani <archange@archlinux.org>

_pkg=pyspnego
pkgname=python-${_pkg}
pkgver=0.10.2
pkgrel=3
pkgdesc="SPNEGO Authentication library"
arch=(any)
url="https://github.com/jborean93/pyspnego"
license=(MIT)
depends=(python-cryptography)
makedepends=(python-build python-installer python-setuptools python-wheel)
checkdepends=(cython python-pytest python-pytest-mock python-gssapi python-krb5 python-ruamel-yaml)
optdepends=('python-gssapi: Kerberos support'
            'python-krb5: Kerberos support'
            'python-ruamel-yaml: YAML configuration')
# No tests in pypi tarball
#source=(https://files.pythonhosted.org/packages/source/${_pkg::1}/${_pkg}/${_pkg}-${pkgver}.tar.gz)
source=(${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha256sums=('eccd86a06050bd802b16c52a2c4e33649aabb23da8b3ccaa6b176894e444564b')

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

check() {
  cd ${_pkg}-${pkgver}
  PYTHONPATH="${PWD}"/build/lib pytest -vv --color=yes
}

package() {
  cd ${_pkg}-${pkgver}
  python -m installer --destdir="${pkgdir}" dist/*.whl
  install -Dm644 LICENSE -t "${pkgdir}"/usr/share/licenses/${pkgname}
}
