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

pkgname=python-crontab
pkgver=3.0.0
pkgrel=1
pkgdesc='A module for reading/writing crontab files & accessing the system cron'
arch=('any')
url='https://gitlab.com/doctormo/python-crontab'
license=('GPL3')
depends=('python' 'python-croniter' 'python-cron-descriptor')
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-wheel'
  'python-setuptools'
)
_commit='31ce3f134c90b8b2eb235f771744f103a0016453'
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
}

# requires usage of a deprecated lib (test.support)
check() {
  cd "$pkgname"
  PYTHONPATH="$(pwd):$PYTHONPATH" python -m unittest
}

package() {
  cd "$pkgname"

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