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

pkgname=python-cron-descriptor
_pkgname="${pkgname#python-}"
pkgver=1.2.31
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-setuptools')
_commit='690ab61c49cb74c2faf8093354a70f0d0cd29956'
source=("$pkgname::git+$url#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

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

build() {
  cd "$pkgname"

  python setup.py build
}

check() {
  cd "$pkgname"

  python -m unittest
}

package() {
  cd "$pkgname"

  python setup.py install --root="$pkgdir" --optimize=1

  # 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
}