# $Id: PKGBUILD 129422 2015-03-17 14:13:08Z tredaelli $
# Maintainer: Timothy Redaelli <timothy.redaelli@gmail.com>
# Contributor: Andy Weidenbaum <archbaum@gmail.com>

pkgname=python2-hidapi
pkgver=0.7.99.5
_pkgver=${pkgver%.*}-${pkgver##*.}
pkgrel=1
pkgdesc="A Cython interface to the hidapi from signal11/hidapi"
arch=('i686' 'x86_64')
depends=('libusb' 'python2')
makedepends=('cython2' 'python2-setuptools')
url="https://github.com/trezor/cython-hidapi"
license=('custom')
source=(https://pypi.python.org/packages/source/h/${pkgname#python2-}/${pkgname#python2-}-$_pkgver.tar.gz)
sha256sums=('9316c34c25a441e0c3f478a5a09a9e360e03d5bf5cf34e7f425419d3d3b6c8ac')

build() {
  cd "${pkgname#python2-}-$_pkgver"

  python2 setup.py build
}

package() {
  cd "${pkgname#python2-}-$_pkgver"

  python2 setup.py install --root="$pkgdir" --optimize=1

  install -dm 755 "$pkgdir/usr/share/licenses/$pkgname"
  echo "You are free to use cython-hidapi code for any purpose." > "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
