# Maintainer: Kyle Keen <keenerd@gmail.com>
# Contributor: Matthew McGinn <mamcgi@gmail.com>
# Contributor: Carl George < arch at cgtx dot us >

_name="click-plugins"
pkgname=python-click-plugins
pkgver=1.1.1
pkgrel=14
pkgdesc="An extension module for click to enable registering CLI commands via setuptools entry-points."
arch=("any")
url="https://github.com/click-contrib/click-plugins"
license=("BSD-3-Clause")
depends=("python-click")
makedepends=("python-setuptools")
checkdepends=("python-pytest" "python-click")
source=("https://pypi.python.org/packages/source/${_name:0:1}/$_name/$_name-$pkgver.tar.gz"
         fix-click-8.2-tests.patch)
sha256sums=('46ab999744a9d831159c3411bb0c79346d94a444df9a3a3742e9ed63645f264b'
            'ac640da158003b7cd9eaf237c3ad3c1af14fc6577c8b6a0046513641f414d6f3')

prepare() {
  cd $_name-$pkgver
  patch -p1 -i ../fix-click-8.2-tests.patch
}

build() {
    cd "$srcdir/$_name-$pkgver"
    python setup.py build
}

check() {
    export LC_ALL="en_US.UTF-8"
    cd "$srcdir/$_name-$pkgver"
    py.test tests
}

package() {
    depends=("python-click")
    cd "$srcdir/$_name-$pkgver"
    python setup.py install --skip-build --root="$pkgdir" --optimize=1
    install -Dm644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
