# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Carl Smedstad <carsme@archlinux.org>
# Contributor: Francois Boulogne <fboulogne at april dot org>

pkgname=python-watchdog
pkgver=6.0.0
pkgrel=1
pkgdesc="Python API and shell utilities to monitor file system events"
arch=('any')
url="https://github.com/gorakhargosh/watchdog"
license=('Apache-2.0')
depends=('python')
makedepends=(
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-wheel'
)
checkdepends=(
  'python-pytest'
  'python-pytest-timeout'
)
optdepends=('python-yaml: for watchmedo')
source=("https://github.com/gorakhargosh/watchdog/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('4a13e1f5b27d1f2d063018ced423709d58ca2a6a77a8d34f59a0bd29b1e34368d38ad0c3b1aa3fbdbf358f72f25da9ba0bbce6d7e23418cb4864cbf1cd4df8bd')

build() {
  cd ${pkgname#python-}-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd ${pkgname#python-}-$pkgver
  # Invokes sudo
  pytest --override-ini="addopts=" \
    --deselect tests/test_inotify_c.py::test_select_fd
}

package() {
  cd ${pkgname#python-}-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
}
