# Maintainer: Robin Candau <antiz@archlinux.com>
# Contributor: Kyle Keen <keenerd@gmail.com>
# Contributor: David Runge <dvzrv@archlinux.org>
# Contributor: shmilee

pkgname=python-mistune
_pkgname=mistune
pkgver=3.0.2
pkgrel=1
epoch=1
pkgdesc="A fast yet powerful Python Markdown parser with renderers and plugins"
arch=('any')
url="https://mistune.lepture.com"
license=('BSD-3-Clause')
depends=('python')
makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
checkdepends=('python-pytest')
source=("https://github.com/lepture/mistune/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha512sums=('c3075f5834e200a900f31478eb652745e3cce4e9cbc25796b65fe3998bdfa05eef327bb851aefd7128577660c3f48982d36bb2cec2d8d2a6fbb64dee2516b57b')
b2sums=('c8e24d4af55cc4ba2fd4288b3296d1846a56f15f04f252325ff01be566b0e1eae830bda59a387d4ef3d95f5d0ee9c75561664fcf0211b48c1f62692a0d414bf6')

build() {
	cd "${_pkgname}-${pkgver}"
	python -m build --wheel --no-isolation
}

check() {
	cd "${_pkgname}-${pkgver}"
	pytest
}

package() {
	cd "${_pkgname}-${pkgver}"
	python -m installer --destdir="${pkgdir}" dist/*.whl

	install -Dm 644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"
	install -Dm 644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
