# Maintainer: Carl Smedstad <carsme@archlinux.org>
# Contributor: Daniel M. Capella <polyzen@archlinux.org>

pkgname=python-tokenize-rt
pkgver=6.2.0
pkgrel=1
pkgdesc='Wrapper around the stdlib tokenize which roundtrips'
arch=('any')
url=https://github.com/asottile/tokenize-rt
license=('MIT')
depends=('python')
makedepends=(
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-wheel'
)
checkdepends=('python-pytest')
source=("$url/archive/v$pkgver/${pkgname#python-}-$pkgver.tar.gz")
b2sums=('19a4c93a069b8bdccc7391c62fa57fc2112b2eb29fd9f16ecd3c937817a3712b4b86f403f0a61b9e7818b0b30a04706d7136adbf12dca5fe8157de8e664d9111')

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

check() {
  cd ${pkgname#python-}-$pkgver
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  test-env/bin/python -m pytest
}

package() {
  cd ${pkgname#python-}-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
}
