summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4efa7c18f9b72c3877f27fd76711bc47cdc50e5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Maintainer: Jonas Malaco <jonas@protocubo.io>
# Contributor: Morten Linderud <foxboron@archlinux.org>
# Contributor: Timothy Redaelli <timothy.redaelli@gmail.com>
# Contributor: Andy Weidenbaum <archbaum@gmail.com>
# Contributor: Kevin Azzam <arch@kevin.azz.am>

pkgname=python-hidapi-git
pkgver=0.10.1.r10.g2353c96
pkgrel=1
arch=('any')
pkgdesc="A Cython interface to the hidapi from signal11/hidapi"
url="https://github.com/trezor/cython-hidapi"
depends=('python' 'hidapi')
makedepends=('cython' 'python-setuptools' 'udev')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
license=('custom')
source=("$pkgname::git+$url#branch=master")
sha512sums=('SKIP')

pkgver() {
  cd "$srcdir/$pkgname"

  git describe --tags --long --abbrev=7 | sed -E 's/^v//;s/([^-]*-g)/r\1/;s/-/./g'
}

build() {
  cd "$srcdir/$pkgname"

  python setup.py build \
        --without-libusb --with-system-hidapi
}

check() {
  cd "$srcdir/$pkgname"

  local python_version=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:2])))')
  PYTHONPATH="$PWD/build/lib.linux-$CARCH-${python_version}" python tests.py
}

package() {
  cd "$srcdir/$pkgname"

  python setup.py install --root="$pkgdir" --optimize=1 --skip-build \
        --without-libusb --with-system-hidapi

  install -Dm 755 LICENSE.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.txt
  install -Dm 755 LICENSE-bsd.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE-bsd.txt
  install -Dm 755 LICENSE-gpl3.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE-gpl3.txt
  install -Dm 755 LICENSE-orig.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE-orig.txt
}