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

pkgname=python-kiwisolver
pkgver=1.4.9
pkgrel=1
pkgdesc="A fast implementation of the Cassowary constraint solver"
url="https://github.com/nucleic/kiwi"
license=('BSD-3-Clause')
arch=('x86_64' 'aarch64')
depends=('python')
makedepends=('git' 'python-cppy' 'python-setuptools-scm' 'python-wheel' 'python-build'
             'python-installer')
checkdepends=('python-pytest')
source=("git+https://github.com/nucleic/kiwi.git#tag=$pkgver")
sha512sums=('a7deafabd3c04fc5c1cd0a78c66b6314f7a220a8d21c6e2dca6a00242c67efa4461f10a87e03f629138770c89d2069d93697b4ee9f2c30a9eb3fba53818c5c48')

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

check() {
  cd kiwi
  local python_version=$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')
  PYTHONPATH="$PWD/build/lib.linux-$CARCH-cpython-$python_version" pytest
}

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