# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer:
# Contributor: Felix Yan <felixonmars@archlinux.org>
# Contributor: Daniel M. Capella <polyzen@archlinux.org>
# Contributor: Felix Kaiser <felix.kaiser@fxkr.net>

pkgname=python-pytest7
_name=pytest
pkgver=7.4.4
pkgrel=3
pkgdesc="Simple powerful testing with Python (legacy version)"
arch=('any')
license=('MIT')
url="https://pytest.org/"
depends=('python-iniconfig' 'python-packaging' 'python-pluggy')
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-setuptools-scm'
  'python-wheel'
)
conflicts=('python-pytest')
provides=('python-pytest')
source=("git+https://github.com/$_name-dev/$_name.git#tag=$pkgver")
b2sums=('1af884d4b31a00565675e103befa16d5f4218abcd693893f5ceeb46eb9498d108a4bb8100244dca57fccc7fe03a5d75d8c6436a02e66265ac53ef0004949b5b9')

build() {
  cd "$_name"
  python -m build --wheel --skip-dependency-check --no-isolation
}

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

  # Symlink license file
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  install -d "$pkgdir"/usr/share/licenses/$pkgname
  ln -s "$site_packages"/"$_name"-$pkgver.dist-info/LICENSE \
    "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
