# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: Simon Sapin <simon dot sapin at exyr dot org>
# Contributor: Kyle Keen <keenerd@gmail.com>

pkgname=python-cssselect2
pkgver=0.8.0
pkgrel=1
pkgdesc='CSS selectors for Python ElementTree'
arch=('any')
url='https://github.com/Kozea/cssselect2'
license=('BSD-3-Clause')
depends=(
  'python'
  'python-tinycss2'
  'python-webencodings'
)
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-flit-core'
)
checkdepends=('python-pytest')
source=("$pkgname::git+$url#tag=$pkgver")
sha512sums=('9baccc2a7869cdb972098f67065d79c432c4bb3d02d21d865d4026d276bd9f8ed7c210d6e9709e6c245decfe1ca33a58b5e2caad03c2c58c57261bdbd599c4fc')
b2sums=('0e97de948bc8d1ce537e13acb3c57d10f47b492923d9c344ff4298f6321cd9079a814a5d57b4b1e4877830a42cf6de4f1cfe932c7481bf3bf41fc4cd73b6fcf8')

build() {
  cd "$pkgname"

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

check() {
  cd "$pkgname"

  pytest -v
}

package() {
  cd "$pkgname"

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

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