# Maintainer: Antonio Rojas <arojas@archlinux.org>

_pyname=pep440
pkgname=python-$_pyname
pkgver=0.1.2
pkgrel=5
pkgdesc='A simple package with utils to check whether versions number match PEP 440'
arch=(any)
url='https://github.com/Carreau/pep440'
license=(MIT)
depends=(python)
makedepends=(git
             python-build
             python-flit-core
             python-installer)
checkdepends=(python-pytest-console-scripts)
source=(git+https://github.com/Carreau/pep440#tag=$pkgver)
sha256sums=('3216a273e9ab81adaa870977252c1cb22b7c21b2d6d0fec89b8485cac0ed94c2')

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

check() {
  cd $_pyname
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  PATH="$PWD/test-env/bin:$PATH" \
  test-env/bin/python -m pytest -v
}

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

  install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
