# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: George Rawlinson <grawlinson@archlinux.org>

pkgname=python-hatch-fancy-pypi-readme
pkgver=24.1.0
pkgrel=3
pkgdesc='Fancy PyPI READMEs with Hatch'
arch=(any)
url='https://github.com/hynek/hatch-fancy-pypi-readme'
license=('MIT')
depends=('python' 'python-hatchling')
makedepends=(
  'git'
  'python-build'
  'python-installer'
)
checkdepends=('python-pytest' 'python-wheel')
_commit='c340dcb0019cae8444fd390929f88ee647ac840d'
source=("$pkgname::git+$url#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

build() {
  cd "$pkgname"

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

check() {
  cd "$pkgname"

  PYTHONPATH="$(pwd)/src" pytest -v
}

package() {
  cd "$pkgname"

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

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