# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer:
pkgname=py3-loky
pkgver=3.5.3
pkgrel=0
pkgdesc="Robust implementation of concurrent.futures.ProcessPoolExecutor"
url="https://loky.readthedocs.io/en/stable/"
arch="noarch"
license="BSD-3-Clause"
depends="python3 py3-cloudpickle"
makedepends="py3-gpep517 py3-setuptools py3-wheel"
checkdepends="py3-pytest py3-psutil"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/joblib/loky/archive/$pkgver.tar.gz"
builddir="$srcdir/loky-$pkgver"
options="net" # net for tests

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
	# test_reusable_executable.py: some of the tests fail/processes hang on x86_64
	# test_wait_result, test_kill_process_tree[*]: flaky on x86_64
	# test_sync_object_handling, test_cpu_count_cgroup_limit: failed on x86_64
	# shellcheck disable=SC2102
	.testenv/bin/python3 -m pytest -v \
		--ignore tests/test_reusable_executor.py \
		--deselect tests/test_synchronize.py::TestCondition::test_wait_result \
		--deselect tests/test_loky_backend.py::test_kill_process_tree[True] \
		--deselect tests/test_loky_backend.py::test_kill_process_tree[False] \
		--deselect tests/test_loky_backend.py::TestLokyBackend::test_sync_object_handling \
		--deselect tests/test_loky_module.py::test_cpu_count_cgroup_limit
}

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

sha512sums="
72924a95cd781cd338f3d9c7fa89bc2e3c1441e64eb4f0199ef8663aa23916920bec5504c9724bec7d128804209cd9c5de58beb756056fbf756d3e5477ef790c  py3-loky-3.5.3.tar.gz
"
