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

_name=decorator
pkgname=python-decorator
pkgver=5.3.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=('55fe7d85849916cecb3f55b582ca325764af654769f5ea93ee3f877304dbc776ab7d0eda8f7d5f6d2f36c18717f7237ab10aef3c8a6b65822a648c9dbaea4772')

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