# Maintainer: Marian Buschsieweke <marian.buschsieweke@posteo.net>
pkgname=py3-kikit
pkgver=1.7.2
pkgrel=0
pkgdesc="Python library and CLI tool to automate several tasks in KiCAD"
url="https://github.com/yaqwsx/KiKit"
# riscv64: py3-shapely
# aarch64, armv7, armhf: py3-solidpython
# s390x: kicad
# ppc64le: py3-solidpython needs openscad
arch="noarch !riscv64 !aarch64 !armv7 !armhf !s390x !ppc64le"
license="MIT"
depends="
	kicad
	py3-click
	py3-commentjson
	py3-markdown2
	py3-pcbnewtransition
	py3-pybars3
	py3-shapely
	py3-solidpython
	python3
	"
makedepends="
	py3-gpep517
	py3-python-versioneer
	py3-setuptools
	py3-wheel
	"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/yaqwsx/KiKit/archive/v$pkgver.tar.gz
	"
builddir="$srcdir/KiKit-$pkgver"

prepare() {
	default_prepare

	# unvendor old versioneer
	rm -f versioneer.py
}

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
	cd test/units
	../../.testenv/bin/python3 -m pytest
}

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

	install -Dm644 LICENCE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}

sha512sums="
dc5040d2294991f9e65e3365d684fa4e117de09ab0320ae41ee59ffb6bb5a502a3b5831432c981cbe59ab941ad66dfa475a9a9bf5a91299effa208ce9762d425  py3-kikit-1.7.2.tar.gz
"
