# Maintainer: Marian Buschsieweke <marian.buschsieweke@posteo.net>
pkgname=py3-solidpython
pkgver=1.1.2
pkgrel=2
pkgdesc="Python library to generated OpenSCAD code"
url="https://github.com/SolidCode/SolidPython"
arch="noarch !aarch64 !armv7 !armhf !s390x !riscv64 !ppc64le" # openscad
license="LGPL-2.1-or-later"
depends="
	openscad
	py3-astroid
	py3-euclid3<0.2.0
	py3-mccabe
	py3-platformdirs
	py3-ply
	py3-prettytable
	py3-pypng
	py3-regex
	py3-setuptools
	py3-tomlkit
	python3
	"
makedepends="
	py3-gpep517
	py3-poetry-core
	"
_pyname="solidpython"
_pypiprefix="${_pyname%"${_pyname#?}"}"
subpackages="$pkgname-pyc"
source="
	https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz
	poetry-core.patch
	"
builddir="$srcdir/$_pyname-$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/*.whl
	.testenv/bin/python3 -m unittest discover solid/test
	# local i; for i in solid/test/test_*.py; do
	# 	echo "$i"
	# 	python3 "$i"
	# done
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
	rm -r "$pkgdir"/usr/lib/python3*/site-packages/solid/test
}

sha512sums="
b66b530fc1abc9c8c3044ad0bb74f7dab2932c77e6374a1e46573f934c2d59af9c24dae86e54201dec7ebae4d3e0dbfa2c2733fa18394a9ce87d5fd562544dc0  solidpython-1.1.2.tar.gz
df25c55af2d6dc6744b344deab129b5128c60d3c768f92018cbf7ceeca06f414fe427c231045ca8f0586a6f2bfbd598f8c2964492bf5def620f4a38ba5d84c96  poetry-core.patch
"
