# Contributor: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
# Maintainer: Iztok Fister, Jr. <iztok@iztok-jr-fister.eu>
pkgname=py3-fireflyalgorithm
_pkgorig=FireflyAlgorithm
pkgver=0.4.5
pkgrel=0
pkgdesc="An implementation of the stochastic nature-inspired algorithm for optimization"
url="https://github.com/firefly-cpp/FireflyAlgorithm"
arch="noarch"
license="MIT"
depends="python3 py3-numpy"
makedepends="py3-gpep517 py3-poetry-core"
checkdepends="py3-pytest-xdist"
subpackages="$pkgname-doc $pkgname-pyc"
source="https://github.com/firefly-cpp/FireflyAlgorithm/archive/$pkgver/$_pkgorig-$pkgver.tar.gz"
builddir="$srcdir/FireflyAlgorithm-$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 pytest -n auto
}

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

	install -Dm644 Problems.md -t "$pkgdir"/usr/share/doc/$pkgname
	install -Dm644 CITATION.cff -t "$pkgdir"/usr/share/doc/$pkgname
}

sha512sums="
9453552b7d6bf215467c24896d7bc65d6a3d1a366d66a939a4b989b309290d6664b153a45c4fce56dc3ce3c479e34e10ef7f6ae0e0354cb3d46ff2a48bbef66a  FireflyAlgorithm-0.4.5.tar.gz
"
