# 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.10.0
_commit=6498a578ba81ccb45d741905d6ef675b1b53a709
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')
conflicts=('python-ptable')
source=("git+https://github.com/jazzband/prettytable.git#commit=$_commit")
sha512sums=('SKIP')

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/
}
