# Maintainer: Filipe Laíns (FFY00) <lains@archlinux.org>

_pkgname=sphinx-argparse-cli
pkgname=python-$_pkgname
pkgver=1.20.1
pkgrel=2
pkgdesc='Render CLI arguments (sub-commands friendly) defined by argparse module'
arch=('any')
url='https://github.com/tox-dev/sphinx-argparse-cli'
license=('MIT')
depends=('python' 'python-sphinx')
makedepends=('python-build' 'python-installer' 'python-hatchling' 'python-hatch-vcs')
checkdepends=('python-pytest')
source=("$pkgname-$pkgver.tar.gz::$url/archive/$pkgver.tar.gz"
        https://github.com/tox-dev/sphinx-argparse-cli/commit/2ecd4278.patch)
sha512sums=('415c22186de95cb21237ed2a73f3ae4d0595e2fec7383e0e957908a543b5cac7d1c54694d03c99c6ba9997fc1d686238167f365fdf02e30a3143d4138afd4000'
            '5b98c4ed1c81bd3ab55e3ff88b1a76723b4c06f276fe3a51feebcf7e29e84f53e0f057b850e6231edc555dda89de49319974802b6986d099996899e89b10cd61')

prepare() {
  cd $_pkgname-$pkgver
  patch -p1 -i ../2ecd4278.patch # Fix tests
}

build() {
  cd $_pkgname-$pkgver

  SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver python -m build -nwx
}

check() {
  cd $_pkgname-$pkgver

  PYTHONPATH=src pytest
}

package() {
  cd $_pkgname-$pkgver

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

  install -Dm 644 LICENSE.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

# vim:set ts=2 sw=2 et:
