2022-11-21 17:40:18 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, CoreFoundation
|
|
|
|
, fetchPypi
|
|
|
|
, IOKit
|
2021-03-19 17:17:44 +00:00
|
|
|
, pytestCheckHook
|
2022-11-21 17:40:18 +00:00
|
|
|
, python
|
|
|
|
, pythonOlder
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "psutil";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "5.9.6";
|
2022-11-21 17:40:18 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
inherit stdenv;
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-5Lkt3NfdTN0/kAGA6h4QSTLHvOI0+4iXbio7KWRBIlo=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
buildInputs =
|
|
|
|
# workaround for https://github.com/NixOS/nixpkgs/issues/146760
|
|
|
|
lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
|
|
|
|
CoreFoundation
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
IOKit
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2022-11-21 17:40:18 +00:00
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
# Segfaults on darwin:
|
|
|
|
# https://github.com/giampaolo/psutil/issues/1715
|
|
|
|
doCheck = !stdenv.isDarwin;
|
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
# In addition to the issues listed above there are some that occure due to
|
|
|
|
# our sandboxing which we can work around by disabling some tests:
|
|
|
|
# - cpu_times was flaky on darwin
|
|
|
|
# - the other disabled tests are likely due to sanboxing (missing specific errors)
|
2021-03-19 17:17:44 +00:00
|
|
|
pytestFlagsArray = [
|
2023-04-12 12:48:02 +00:00
|
|
|
# Note: $out must be referenced as test import paths are relative
|
2021-03-19 17:17:44 +00:00
|
|
|
"$out/${python.sitePackages}/psutil/tests/test_system.py"
|
|
|
|
];
|
2021-05-28 09:39:13 +00:00
|
|
|
|
2021-03-19 17:17:44 +00:00
|
|
|
disabledTests = [
|
2023-04-12 12:48:02 +00:00
|
|
|
# Some of the tests have build-system hardware-based impurities (like
|
|
|
|
# reading temperature sensor values). Disable them to avoid the failures
|
|
|
|
# that sometimes result.
|
2022-11-21 17:40:18 +00:00
|
|
|
"cpu_freq"
|
|
|
|
"cpu_times"
|
2021-03-19 17:17:44 +00:00
|
|
|
"disk_io_counters"
|
|
|
|
"sensors_battery"
|
2023-04-12 12:48:02 +00:00
|
|
|
"sensors_temperatures"
|
2022-11-21 17:40:18 +00:00
|
|
|
"user"
|
2023-01-20 10:41:00 +00:00
|
|
|
"test_disk_partitions" # problematic on Hydra's Linux builders, apparently
|
2021-03-19 17:17:44 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"psutil"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
2022-11-21 17:40:18 +00:00
|
|
|
description = "Process and system utilization information interface";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/giampaolo/psutil";
|
2023-05-24 13:37:59 +00:00
|
|
|
changelog = "https://github.com/giampaolo/psutil/blob/release-${version}/HISTORY.rst";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ jonringer ];
|
|
|
|
};
|
|
|
|
}
|