# Template file for 'python3-psutil'
pkgname=python3-psutil
version=5.9.8
revision=2
build_style=python3-pep517
# Failing tests: see https://github.com/giampaolo/psutil/issues/2043
make_check_args="--import-mode=importlib
 --deselect psutil/tests/test_contracts.py::TestFetchAllProcesses::test_all
 --deselect psutil/tests/test_linux.py::TestProcess::test_exe_mocked
 --deselect psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_against_findmnt
 --deselect psutil/tests/test_linux.py::TestSystemVirtualMemoryAgainstFree::test_used
 --deselect psutil/tests/test_linux.py::TestSystemVirtualMemoryAgainstVmstat::test_used
 --deselect psutil/tests/test_misc.py::TestCommonModule::test_debug
 --deselect psutil/tests/test_process.py::TestProcess::test_terminal
 --deselect psutil/tests/test_system.py::TestDiskAPIs::test_disk_partitions
 --deselect psutil/tests/test_system.py::TestMiscAPIs::test_users"
hostmakedepends="python3-setuptools python3-wheel"
makedepends="python3-devel"
depends="python3"
# two tests use `util-linux` (findmnt), but it conflicts `chroot-util-linux`
checkdepends="python3-pytest procps-ng inetutils-ifconfig"
short_desc="Cross-platform process and system utilities module for Python3"
maintainer="skmpz <dem.procopiou@gmail.com>"
license="BSD-3-Clause"
homepage="https://github.com/giampaolo/psutil"
changelog="https://raw.githubusercontent.com/giampaolo/psutil/master/HISTORY.rst"
distfiles="${PYPI_SITE}/p/psutil/psutil-${version}.tar.gz"
checksum=6be126e3225486dff286a8fb9a06246a5253f4c7c53b475ea5f5ac934e64194c

if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
	# This test fails because RLIMIT_RTTIME is n/a in musl 1.1
	make_check_args+=" --deselect
	psutil/tests/test_contracts.py::TestAvailConstantsAPIs::test_rlimit"
fi

if [ "$XBPS_BUILD_ENVIRONMENT" = void-packages-ci ]; then
	# Tests that fail on CI; the first one actually hangs!
	make_check_args+="
	--deselect psutil/tests/test_process.py::TestProcess::test_wait_non_children
	--deselect psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_comparisons
	--deselect psutil/tests/test_linux.py::TestRootFsDeviceFinder::test_disk_partitions_mocked
	--deselect psutil/tests/test_process.py::TestProcess::test_children_recursive
	--deselect psutil/tests/test_process.py::TestProcess::test_oneshot_cache
	--deselect psutil/tests/test_process.py::TestProcess::test_parent_multi
	--deselect psutil/tests/test_process.py::TestProcess::test_parents
	--deselect psutil/tests/test_process.py::TestProcess::test_parents_and_children
	--deselect psutil/tests/test_process.py::TestProcess::test_zombie_process
	--deselect psutil/tests/test_testutils.py::TestProcessUtils::test_reap_children
	--deselect psutil/tests/test_testutils.py::TestProcessUtils::test_spawn_children_pair
	--deselect psutil/tests/test_testutils.py::TestProcessUtils::test_spawn_zombie
	--deselect psutil/tests/test_testutils.py::TestProcessUtils::test_terminate
	--deselect psutil/tests/test_testutils.py::TestMemLeakClass::test_leak_mem
	--deselect psutil/tests/test_process.py::TestPopen::test_misc
	"
fi

post_install() {
	rm -r ${DESTDIR}/${py3_sitelib}/psutil/tests/
	vlicense LICENSE
}
