# Maintainer: Carl Smedstad <carsme@archlinux.org>
# Contributor: Eli Schwartz <eschwartz@archlinux.org>

pkgname=python-dbus-deviation
_pkgname=${pkgname#python-}
pkgver=0.6.1
pkgrel=9
pkgdesc="Parse D-Bus introspection XML and process it in various ways"
arch=(any)
url="https://github.com/pwithnall/dbus-deviation"
license=('LGPL-2.1-or-later')
depends=(
  python
  python-lxml
)
makedepends=(
  git
  python-build
  python-installer
  python-setuptools
  python-setuptools-git
  python-sphinx
  python-wheel
)
source=(
  "git+$url#tag=$pkgver"
  "unittest-deprecations.patch"
)
sha256sums=('d962dcd13ffd3c82ab92ceb2856916ea38ee1dab81d354e68ca34a41c88a3d2c'
            '14e81aef7e26feef6cd330fb85b264da5f173ccabc1d30f84bcfa49edf9734c2')

prepare() {
  cd "$_pkgname"
  patch -Np1 -i ../unittest-deprecations.patch
}

build() {
  cd "$_pkgname"
  python -m build --wheel --no-isolation
}

check() {
  cd "$_pkgname"
  python -m unittest discover -vs dbusapi/tests
}

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