# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Felix Yan <felixonmars@archlinux.org>

_name=cerberus
pkgname=python-cerberus
pkgver=1.3.5
pkgrel=3
pkgdesc="Lightweight, extensible schema and data validation tool for Python dictionaries"
url="https://github.com/pyeve/cerberus"
license=(ISC)
arch=(any)
depends=(
  python
)
makedepends=(
  python-build
  python-installer
  python-setuptools
  python-wheel
)
checkdepends=(
  python-pytest
  python-pytest-benchmark
)
source=($pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz)
sha512sums=('eaa91f229a009770a1750a51e82c34f06dffeebca7af7cafd5ba3a8529502326dd20af1ed7a60fd5e5ed28edb4b974712b1493aa1e330097a8e36ad70c5e4f23')
b2sums=('1f7f1c6804702dea6ab31c3e278a4d769c80c898e786aa7c7f7df0bc212edf07c4026c5dd6adf7ecdcacfd596ec33c3493ec26c3de68bd8254fce56e6532fff7')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
  # NOTE: remove build dir as pytest otherwise chokes on duplicate imports
  rm -frv build
}

check() {
  cd $_name-$pkgver
  pytest -vv
}

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

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