# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Mark Wagie <mark dot wagie at tutanota dot com>
# Contributor: Thomas Andrejak <thomas.andrejak@gmail.com>

pkgname=python-croniter
pkgver=1.3.8
pkgrel=1
pkgdesc='Provides iteration for the datetime object with a cron like format'
arch=('any')
url='https://github.com/kiorky/croniter'
license=('MIT')
depends=('python' 'python-dateutil' 'python-natsort')
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-wheel'
  'python-setuptools'
)
checkdepends=('python-pytest' 'python-pytz')
_commit='ddbee2c6cbb2bd6ccbf73a9ef1e2e223fa0d6c73'
source=("$pkgname::git+$url.git#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"

  pytest -v
}

package() {
  cd "$pkgname"

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

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

  # documentation
  install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" {README,CHANGELOG}.rst
}