# Maintainer: Carl Smedstad <carsme@archlinux.org>
# Contributor: Blair Bonnett <blair.bonnett@gmail.com>

pkgname=python-scikit-build-core
pkgver=0.11.6
pkgrel=1
pkgdesc='Next generation Python CMake adaptor and Python API for plugins'
arch=(any)
url='https://github.com/scikit-build/scikit-build-core'
license=(Apache-2.0)
depends=(
  cmake
  ninja
  python
  python-packaging
  python-pathspec
)
makedepends=(
  python-build
  python-hatch-vcs
  python-hatchling
  python-installer
)
checkdepends=(
  pybind11
  python-cattrs
  python-fastjsonschema
  python-hatch-fancy-pypi-readme
  python-numpy
  python-pytest
  python-pytest-subprocess
  python-setuptools-scm
  python-typing_extensions
  python-validate-pyproject
  python-virtualenv
)
source=("$url/archive/v$pkgver/${pkgname#python-}-$pkgver.tar.gz")
sha512sums=('f70925b07f5b62df6b70696b3641f173b9d6087a3636db6419716802c3da7faf6ac49feb98da9b065f0ddec74398e5d61f4a66888205db9bac28764c43b1eb0f')

build() {
  cd ${pkgname#python-}-$pkgver
  python -m build --wheel --no-isolation
}

# NOTE: upstream hardcodes downloading the internet with pip:
# https://github.com/scikit-build/scikit-build-core/issues/720
check() {
  cd ${pkgname#python-}-$pkgver
  python -m venv --system-site-packages test-env
  test-env/bin/python -m installer dist/*.whl
  test-env/bin/python -m pytest -k 'not network'
}

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