# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Kyle Keen <keenerd@gmail.com>
# Contributor: wenLiangcan <boxeed at gmail dot com>

pkgname=python-wcwidth
pkgver=0.2.14
pkgrel=1
pkgdesc='Python library that measures the width of unicode strings rendered to a terminal'
arch=(any)
url='https://github.com/jquast/wcwidth'
license=(MIT)
depends=(python)
makedepends=(
  git
  python-build
  python-installer
  python-setuptools
  python-wheel
)
checkdepends=(python-pytest)
source=("$pkgname::git+$url#tag=$pkgver")
sha512sums=('b5c177995d5cce9c69333385caf7fa750f74a1f5daaad9c90c82e42d7213995f11e423f3a2442c058d14d922ca5525fdfdbf110feb18c58679114fdb0476b1aa')
b2sums=('38edec0cbc294b392a9eba5010aa7222c82d99a6070eb76485b9ea83a5a3bc0c78bb4d4a7b7066188b42a8a41c8c18a89b1846f6a9fba9f40e54c78a283bbf3d')

build() {
  cd "$pkgname"

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

check() {
  cd "$pkgname"

  rm -v tox.ini

  export PYTHONPATH=.
  pytest -v
}

package() {
  cd "$pkgname"

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

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