# Maintainer: Thomas Dziedzic < gostrc at gmail >
# Contributor: Pierre Chapuis <catwell at archlinux dot us>

_name=decorator
pkgname=python-decorator
pkgver=5.2.1
pkgrel=1
pkgdesc='Python Decorator module'
arch=('any')
url='https://pypi.python.org/pypi/decorator'
license=('BSD-2-Clause')
depends=('python')
makedepends=('python' 'python-setuptools' 'python-build' 'python-installer' 'python-wheel')
source=("https://pypi.python.org/packages/source/${_name:0:1}/${_name}/${_name}-${pkgver}.tar.gz")
sha512sums=('c834a3536e429aaff38d34a56b574344551c160e25676ca5febb5dcf521d71f284ebb8294d3264f65a801219860352377e5a4be89927217cb5da9cb6c6aa45ec')

build() {
  cd "$srcdir/$_name-$pkgver"

  python -m build --wheel --no-isolation
}

package() {
  cd "${srcdir}/${_name}-${pkgver}"

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

  install -D -m644 LICENSE.txt \
    "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

check() {
  cd "$srcdir/${_name}-$pkgver"

  PYTHONPATH=src python -m unittest discover -vs tests/
}
