# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-kiwisolver
pkgver=1.4.5
_commit=03adafeb0f1188e34cde4c7ca8fe384912bd9e1b
pkgrel=3
pkgdesc="A fast implementation of the Cassowary constraint solver"
url="https://github.com/nucleic/kiwi"
license=('Artistic-1.0-Perl')
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
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#commit=$_commit")
sha512sums=('7ec0211a888e9402fa85e2821a76fff138810f5758c6e621f365bf6a9b2142adcba3dfaf0f98688e431bb3019b9177a56f6413afaedecd9e8137e57c858426d4')

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
}
