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

pkgname=python-cron-descriptor
_pkgname="${pkgname#python-}"
pkgver=1.2.34
pkgrel=1
pkgdesc='A Python library that converts cron expressions into human readable strings'
arch=('any')
url='https://github.com/Salamek/cron-descriptor'
license=('MIT')
depends=('python')
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-wheel'
  'python-setuptools'
)
checkdepends=('python-mock')
_commit='f1a0c3c5b3ad49e0e9815b3d777af30155cb85b3'
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"

  python -m unittest
}

package() {
  cd "$pkgname"

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

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

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