# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Daniel Wallace <danielwallace at gtmanfred dot com>
# Contributor: Sebastien Leduc <sebastien@sleduc.fr>
# Contributor: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>

pkgname=python-prettytable
pkgver=3.16.0
pkgrel=1
pkgdesc="A simple Python library for easily displaying tabular data"
url="https://github.com/jazzband/prettytable"
arch=('any')
license=('BSD')
depends=('python-wcwidth')
makedepends=('git' 'python-build' 'python-installer' 'python-hatchling' 'python-hatch-vcs')
checkdepends=('python-pytest-lazy-fixtures' 'python-coverage')
conflicts=('python-ptable')
source=("git+https://github.com/jazzband/prettytable.git#tag=$pkgver")
sha512sums=('5ab1d7dc05b0b927789f6a34dc5138363df1d8c90f313858ee3259cb863ca161e45b419f4bb95be15869458024c11f60df6b23e18c1552d3ff7e50aa21e99bf6')

build() {
  cd prettytable
  python -m build -nw
}

check() {
  cd prettytable
  python -m installer --destdir="$PWD/tmp_install" dist/*.whl
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  PYTHONPATH="$PWD/tmp_install/$site_packages" pytest
}

package() {
  cd prettytable
  python -m installer -d "$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
