# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Carl Smedstad <carsme@archlinux.org>

pkgname=python-legacy-cgi
_pkgname=${pkgname#python-}
pkgver=2.6.2
pkgrel=1
pkgdesc="Fork of the standard library cgi and cgitb modules, being deprecated in PEP-594"
arch=(any)
url="https://github.com/jackrosenthal/legacy-cgi"
license=('PSF-2.0')
depends=('python')
makedepends=(
  'python-build'
  'python-installer'
  'python-poetry-core'
  'python-wheel'
)
checkdepends=('python-pytest')
source=("$url/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha256sums=('cb47ba975c9d7b670e209e337d4bbabfa749652fd69f2efbee2038aaa6b17a5b')

build() {
  cd "$_pkgname-$pkgver"
  python -m build --wheel --no-isolation
}

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

package() {
  cd "$_pkgname-$pkgver"
  python -m installer --destdir="$pkgdir" dist/*.whl
}
