# Contributor: omni <omni+alpine@hack.org>
# Maintainer: omni <omni+alpine@hack.org>
pkgname=jc
pkgver=1.25.3
pkgrel=0
pkgdesc="CLI & python library converting output of common tools, file-types & strings to JSON, YAML or dicts"
url="https://kellyjonbrazil.github.io/jc/"
arch="noarch"
license="MIT"
depends="py3-pygments py3-ruamel.yaml py3-xmltodict"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest tzdata"
subpackages="
	$pkgname-doc
	$pkgname-bash-completion
	$pkgname-zsh-completion
	$pkgname-pyc
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/kellyjonbrazil/jc/archive/refs/tags/v$pkgver.tar.gz"

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/*.whl
	TZ="America/Los_Angeles" \
		.testenv/bin/python3 -m pytest -k "not test_ip_address_ipv6_6to4"
}

package() {
	python3 -m installer -d "$pkgdir" .dist/*.whl

	install -Dm644 man/"$pkgname".1 "$pkgdir"/usr/share/man/man1/"$pkgname".1
	install -Dm644 -t "$pkgdir"/usr/share/doc/"$pkgname"/ \
		README.md EXAMPLES.md
	cp -r docs "$pkgdir"/usr/share/doc/"$pkgname"/

	install -Dm644 completions/jc_bash_completion.sh \
		"$pkgdir"/usr/share/bash-completion/completions/$pkgname
	install -Dm644 completions/jc_zsh_completion.sh \
		"$pkgdir"/usr/share/zsh/site-functions/_$pkgname
}

sha512sums="
c832e3d81d5deedc12e9d9017a60ee1348c96d748dd13fadced1447c275518716b02376113fff536889549eb8ea1fc2c04cb078fb74f6476e361fd842fd1d488  jc-1.25.3.tar.gz
"
