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

pkgname=python-ukkonen
pkgver=1.1.0
pkgrel=1
pkgdesc="Implementation of bounded Levenshtein distance (Ukkonen)"
url="https://github.com/asottile/ukkonen"
license=('MIT')
arch=('x86_64' 'aarch64')
depends=('python' 'python-cffi')
makedepends=('git' 'python-build' 'python-installer' 'python-setuptools')
checkdepends=('python-pytest')
source=("git+https://github.com/asottile/ukkonen.git#tag=v$pkgver")
sha512sums=('a920a33e41ffc3a64ea20e9b4347ce2ce8050cefbe5bdd83804c797f40c71e39422f102a01635c3efc05855462dc29010d8a76abf5b9b3f28e7a02073aa6caa2')

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

check() {
  cd ukkonen
  python -m venv --system-site-packages .test-env
  .test-env/bin/python -m installer dist/*.whl
  .test-env/bin/python -m pytest
}

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