# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=jrnl
pkgver=2.8.3
pkgrel=1
pkgdesc="Collect your thoughts and notes without leaving the command line"
arch=('any')
url="https://jrnl.sh/"
license=('GPL3')
depends=('python-ansiwrap' 'python-asteval' 'python-colorama' 'python-cryptography' 'python-keyring'
         'python-parsedatetime' 'python-dateutil' 'python-pyxdg' 'python-yaml' 'python-pytz'
         'python-tzlocal')
makedepends=('python-dephell')
checkdepends=('python-behave' 'python-pytest' 'python-pytest-bdd')
source=("https://github.com/jrnl-org/jrnl/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('00dc9f8364c6f057a7667bc1de3857fc8cc3393832c3198f1726dfdf567a28556b8a818c67828c9fbdb36ebbd4c9066545b4b15943253d7c6c9949ab07701f32')

prepare() {
  cd jrnl-$pkgver

  # poetry-generated setup.py is badly broken in several ways, including
  # distribution of tests in the built package as well as using distutils for
  # bad metadata. See https://github.com/sdispater/poetry/issues/866
  dephell deps convert --from pyproject.toml --to setup.py
}

build() {
  cd jrnl-$pkgver
  python setup.py build
}

check() {
  cd jrnl-$pkgver
  python -m pytest
  behave
}

package() {
  cd jrnl-$pkgver
  python setup.py install -O1 --prefix=/usr --root="$pkgdir"
}

# vim:set ts=2 sw=2 et:
