# Contributor: Patrycja Rosa <alpine@ptrcnull.me>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=smartypants
pkgver=2.0.1
pkgrel=4
pkgdesc="Translate plain ASCII punctuation characters into “smart” typographic punctuation HTML entities"
url="https://github.com/leohemsted/smartypants.py"
arch="noarch"
license="BSD"
makedepends="py3-setuptools py3-sphinx py3-gpep517 py3-wheel"
subpackages="$pkgname-doc $pkgname-pyc"
source="https://github.com/leohemsted/smartypants.py/archive/v$pkgver/smartypants-$pkgver.tar.gz
	python-3.12.patch"
builddir="$srcdir/smartypants.py-$pkgver"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2

	make -C docs man
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m unittest discover tests
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl

	install -Dm644 docs/_build/man/smartypants.1 "$pkgdir"/usr/share/man/man1/smartypants.1
}

sha512sums="
d47a866a5478c3520251f87a93a468a5eea10318b24b2e8d4bc918d533b5a5789aa56d3a8d5fb8ccff9572fb63e5b6f2eafc44f93fb57a19e6621ebef5d64d9d  smartypants-2.0.1.tar.gz
a4a8a6aa6896aee6369b35e7f0aafda0c96e1e667daa1c866be6665f56dbfa8dd63f51f0b07a8767e9e0673b8b67a678b78bbfa0155b8ec823107195148f7c24  python-3.12.patch
"
