# Maintainer: Daniel M. Capella <polyzen@archlinux.org>

_name=roman-numerals
pkgname=python-roman-numerals-py
pkgver=3.1.0
pkgrel=1
pkgdesc='Manipulate well-formed Roman numerals'
arch=(any)
url=https://github.com/AA-Turner/roman-numerals/tree/master/python
license=('0BSD OR CC0-1.0')
depends=(python)
makedepends=(
  git
  python-build
  python-flit-core
  python-installer
)
checkdepends=(python-pytest)
source=("git+https://github.com/AA-Turner/roman-numerals.git#tag=v$pkgver")
b2sums=('4561729718b9a77cc4c1af237507b652564f1307d2ce3a9c21fc796b68013174045b545c1930119d5d171dbc61102996606a41224d7f055edaf967ed173aa23e')

prepare() {
  cd $_name
  ln -ft python LICENCE.rst
}

build() {
  cd $_name/python
  python -m build --wheel --skip-dependency-check --no-isolation
}

check() {
  cd $_name/python
  pytest
}

package() {
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  install -d "$pkgdir"/usr/share/licenses/$pkgname
  ln -s "$site_packages"/roman_numerals_py-$pkgver.dist-info/licenses/LICENCE.rst \
    "$pkgdir"/usr/share/licenses/$pkgname/LICENCE.rst

  cd $_name/python
  python -m installer --destdir="$pkgdir" dist/*.whl
}
