# Contributor: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
# Maintainer: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
pkgname=py3-gplearn
pkgver=0.4.2
pkgrel=3
pkgdesc="Genetic Programming in Python, with a scikit-learn inspired API"
url="https://github.com/trevorstephens/gplearn"
# py3-scikit-learn is missing on s390x
arch="noarch !s390x"
license="BSD-3-Clause"
depends="
	python3
	py3-joblib
	py3-scikit-learn
	"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest-xdist"
subpackages="$pkgname-pyc"
source="https://github.com/trevorstephens/gplearn/archive/$pkgver/gplearn-$pkgver.tar.gz"
builddir="$srcdir/gplearn-$pkgver"

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

check() {
	local skipped_tests
	local excludes="
		not test_sklearn_regressor_checks
		and not test_sklearn_classifier_checks
		and not test_transformer_iterable
		"
	for t in $excludes; do
		skipped_tests="$skipped_tests $t"
	done
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -n auto -k "$skipped_tests"
}

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

sha512sums="
553384047d4cc6a503315c073e2b60890ba9058395581d226718897cb64477f16cec28134a6ce7bb83f29c7f2a688b21c6fbeafd47242eea7d1724f844e3a919  gplearn-0.4.2.tar.gz
"
