# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-execnet
pkgver=2.1.1
pkgrel=4
pkgdesc="Rapid multi-Python deployment"
arch=('any')
license=('MIT')
url="https://codespeak.net/execnet"
depends=('python')
makedepends=(
  'git'
  'python-build'
  'python-installer'
  'python-hatchling'
  'python-hatch-vcs'
)
checkdepends=(
  'openssh'
  'procps-ng'
  'python-pytest'
  'python-pytest-timeout'
)
source=("git+https://github.com/pytest-dev/execnet.git#tag=v$pkgver")
sha512sums=('5886ff851fe868337a259988b55029f6becdae8a5282d636f647180dd3aedc23d134352e6081b5c28abf2cd26fa2a2ead68de49608d5bff50b2d3d80b1bcdb04')

build() {
  cd execnet
  python -m build --wheel --no-isolation
}

check() {
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")

  cd execnet
  # install to temporary location, as importlib is used
  python -m installer --destdir=test_dir dist/*.whl
  export PYTHONPATH="test_dir/$site_packages:$PYTHONPATH"
  pytest -vv testing
}

package() {
  cd execnet
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
