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

_realname=pluggy
pkgbase=python-pluggy
pkgname=(python-${_realname})
pkgver=1.3.0
pkgrel=2
pkgdesc="Plugin and hook calling mechanisms for python"
arch=('any')
url="https://github.com/pytest-dev/pluggy"
license=('spdx:MIT')
depends=('python')
makedepends=(
  'python-setuptools'
  'python-setuptools-scm'
  'python-wheel'
  'python-build'
  'python-installer'
)
provides=("python3-${_realname}")
replaces=("python3-${_realname}")
conflicts=("python3-${_realname}")
source=("${pkgbase}-${pkgver}.tar.gz::https://github.com/pytest-dev/pluggy/archive/${pkgver}.tar.gz")
sha512sums=('42263292ae6a3139c023604bb8b02768215a23e55f3ff900ae929e10438778874bc31bce9d8525689f3f702402a5290da47c314ac3d0cc16b00c01bd5ae458b0')

prepare() {
  # Set version for setuptools_scm
  export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
}

build() {
  cd "${srcdir}/${_realname}-${pkgver}"

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

check() {
  cd "${srcdir}/${_realname}-${pkgver}"

  python -m pytest
}

package() {
  cd "${srcdir}/${_realname}-${pkgver}"

  python -m installer --destdir="${pkgdir}" dist/*.whl
  install -Dm644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
}
