# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>

_realname='pytest'
pkgbase="python-${_realname}"
pkgname="python-${_realname}"
pkgver=9.1.1
pkgrel=1
pkgdesc='Simple powerful testing with Python'
arch=('any')
url='https://pytest.org/'
msys2_repository_url='https://github.com/pytest-dev/pytest'
msys2_references=(
  'anitya: 3765'
  'archlinux: python-pytest'
  'gentoo: dev-python/pytest'
  'purl: pkg:pypi/pytest'
)
license=('spdx:MIT')
depends=(
  'python'
  'python-iniconfig'
  'python-packaging'
  'python-pluggy'
  'python-pygments'
)
makedepends=(
  'python-build'
  'python-installer'
  'python-setuptools'
  'python-setuptools-scm'
)
checkdepends=(
  # 'python-attrs'
)
provides=(
  'python3-pytest'
)
conflicts=(
  'python3-pytest'
)
replaces=(
  'python3-pytest'
)
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('1088fbde8f2b49d95a549a195707afa7a76a3ce9bcadc26b6d71f0ffda5fe313')

build() {
  cp -r "${_realname}-${pkgver}" "build-${MSYSTEM}" && cd "build-${MSYSTEM}"

  export SETUPTOOLS_SCM_PRETEND_VERSION="${pkgver}"

  python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd "build-${MSYSTEM}"

  python -m installer --prefix=/usr --destdir="${pkgdir}" dist/*.whl

  install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}/"
}
