# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=python-tidylib
pkgver=0.3.2
pkgrel=1
pkgdesc='Python wrapper around tidyhtml parser/cleaner'
arch=('any')
url='https://countergram.github.io/pytidylib/'
license=('MIT')
depends=('python' 'tidyhtml')
makedepends=('git' 'python-setuptools' 'python-build' 'python-installer' 'python-wheel')
_commit='25bc4713f4fe42bccbd61fb8454ae5b4814063b6'
source=("$pkgname::git+https://github.com/countergram/pytidylib#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

build() {
  cd "$pkgname"

  python -m build --wheel --no-isolation
}

check() {
  cd "$pkgname"

  python -m unittest discover
}

package() {
  cd "$pkgname"

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

  # license
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}