# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=python-isoduration
_pkgname="${pkgname#python-}"
pkgver=20.11.0
pkgrel=5
pkgdesc='Operations with ISO 8601 durations'
arch=('any')
url='https://github.com/bolsote/isoduration'
license=('ISC')
depends=('python' 'python-arrow')
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-wheel'
  'python-setuptools'
)
checkdepends=(
  'python-pytest'
  'python-pytest-benchmark'
  'python-isodate'
  'python-hypothesis'
)
_commit='f7316c5dad4d087d823795feaa401653906ac340'
source=("$pkgname::git+$url#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

build() {
  cd "$pkgname"

  python -m build --wheel --no-isolation
}

check() {
  cd "$pkgname"

  PYTHONPATH="$PWD/src:$PYTHONPATH" pytest -v
}

package() {
  cd "$pkgname"

  python -m installer --destdir="$pkgdir" dist/*.whl

  # documentation
  install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md

  # license
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}
