# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=py3-mirakuru
pkgver=2.5.3
pkgrel=0
#_pkgreal is used by apkbuild-pypi to find modules at PyPI
_pkgreal=mirakuru
pkgdesc="Process executor (not only) for tests."
url="https://pypi.python.org/project/mirakuru"
arch="noarch"
license="LGPL-3.0-only"
depends="py3-psutil"
checkdepends="py3-daemon py3-pytest netcat-openbsd bash procps-ng"
makedepends="py3-setuptools py3-gpep517 py3-wheel"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/ClearcodeHQ/mirakuru/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/$_pkgreal-$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 "$builddir"/.dist/*.whl
	# tests/executors/test_executor.py::test_stop_custom_exit_signal_context: failure in 32-bit arches
	# mirakuru.exceptions.ProcessFinishedWithError: The process invoked by the <mirakuru.base.SimpleExecutor: "false" 0xf6491780> executor has exited with a non-zero code: 1.
	# tests/executors/test_executor_kill.py::test_daemons_killing: failure in armhf
	# assert SAMPLE_DAEMON_PATH not in ps_aux()
	.testenv/bin/python3 -m pytest -v -k 'not test_stop_custom_exit_signal_context and not test_daemons_killing'
}

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

sha512sums="
2568c01386d0ab5712a8cdf52935a973a98ba2874717fadbac1bd9a8a4ff9c776db1a88898b855ff01b81f8712b1c911e2bd6922a5b54eccde1f004e239d8ea2  py3-mirakuru-2.5.3.tar.gz
"
