# Maintainer: Filipe LaĆ­ns (FFY00) <lains@archlinux.org>

# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
#  - remove makedepend on python-pypandoc

pkgname=hid-tools
pkgver=0.9
pkgrel=1
arch=('any')
url='https://gitlab.freedesktop.org/libevdev/hid-tools'
license=('GPL2')
pkgdesc='Python scripts to manipulate HID data'
depends=('python-parse' 'python-pyudev' 'python-libevdev' 'python-click' 'python-yaml')
makedepends=('python-build' 'python-installer' 'python-hatchling' 'python-sphinx' 'python-sphinx_rtd_theme' 'python-sphinxcontrib-apidoc')
source=("$url/-/archive/$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('e48668ad2a3423ef91805178a48aa355b5231712cd1ded36194c814a7eaacb80d767fc95e1e76cc9a94dcb6d28074abf4a92574c168a042e930890b57216ed97')

build() {
  cd $pkgname-$pkgver

  python -m build -wnx

  cd doc/source

  sphinx-build -b html . _build
}

package() {
  cd $pkgname-$pkgver

  python -m installer --destdir="$pkgdir" dist/*.whl

  # Install documentation
  install -dm 755 "$pkgdir"/usr/share/doc/$pkgname/html
  cp -r -a --no-preserve=ownership doc/source/_build/* "$pkgdir"/usr/share/doc/$pkgname/html
}