# Maintainer: Carl Smedstad <carsme@archlinux.org>
# Contributor: Jiachen Yang <farseerfc@gmail.com>
# Contributor: Chris Warrick <aur@chriswarrick.com>

pkgname=python-typogrify
pkgver=2.1.0
pkgrel=1
pkgdesc='filters to make caring about typography on the web a bit easier'
arch=('any')
url='https://github.com/justinmayer/typogrify'
license=('BSD-3-Clause')
depends=(
  'python'
  'python-smartypants'
)
makedepends=(
  'python-build'
  'python-hatchling'
  'python-installer'
  'python-wheel'
)
checkdepends=('python-pytest')
source=("$url/archive/$pkgver/${pkgname#python-}-$pkgver.tar.gz")
sha256sums=('212603210fb5a55fd5bed4c34cd9043b96ab605b190d4e17e27396330147e523')

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

check() {
  cd ${pkgname#python-}-$pkgver
  pytest --doctest-modules \
    typogrify/filters.py \
    typogrify/packages/titlecase/tests.py
}

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