# Contributor: Fabian Affolter <fabian@affolter-engineering.ch>
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=py3-ansi2html
_pkgname=ansi2html
pkgver=1.9.2
pkgrel=0
pkgdesc="Convert text with ANSI color codes to HTML"
url="https://github.com/pycontribs/ansi2html"
arch="noarch"
license="LGPL-3.0-or-later"
depends="python3"
makedepends="
	py3-gpep517
	py3-installer
	py3-setuptools_scm
	py3-wheel
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/${_pkgname:0:1}/$_pkgname/$_pkgname-$pkgver.tar.gz"
builddir="$srcdir"/$_pkgname-$pkgver

replaces="py-ansi2html" # for backwards compatibility
provides="py-ansi2html=$pkgver-r$pkgrel" # for backwards compatibility

export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver

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

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/ansi2html-$pkgver-py3-none-any.whl
	PATH="$PATH:$PWD/.testenv/bin" .testenv/bin/python3 -m pytest
}

package() {
	python3 -m installer --destdir "$pkgdir" \
		.dist/ansi2html-$pkgver-py3-none-any.whl
}

sha512sums="
c465259d4c9ea82725bcd8cd286246b806b1bfde06f89b52b1cc3cd5c514be92a19ffcfd147417d64ce6da6627678baabc7ff05226ed392343cdb0496bd375eb  ansi2html-1.9.2.tar.gz
"
