# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>

pkgname=python-libevdev
pkgver=0.11
pkgrel=4
arch=(any)
url='https://gitlab.freedesktop.org/libevdev/python-libevdev'
license=('MIT')
pkgdesc='Python wrapper for libevdev'
depends=('python' 'libevdev')
makedepends=('python-setuptools' 'python-sphinx' 'python-sphinx_rtd_theme')
checkdepends=('python-pytest' 'python-pluggy')
source=("$url/-/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('224e2d18915f08d9f02e32845968e0e2eac531ad7f4efe5401de692cdb0980049f3cfd9cb869319e7526dbefd38144ab6e0b52ceba67ab371045ce60d21286da')

build() {
  cd $pkgname-$pkgver

  python setup.py build

  make doc
}

check() {
  cd $pkgname-$pkgver

  PYTHONPATH=. pytest test/*.py
}

package() {
  cd $pkgname-$pkgver

  python setup.py install --root "$pkgdir" --skip-build -O1

  # Install documentation
  install -dm 755 "$pkgdir"/usr/share/doc/$pkgname
  cp -r -a --no-preserve=ownership doc/html "$pkgdir"/usr/share/doc/$pkgname
  install -D -m644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}"
  rm -rf "$pkgdir"/usr/share/doc/$pkgname/html/.doctrees
}
