2020-04-24 23:36:52 +00:00
|
|
|
{ lib, stdenv, buildPythonPackage, fetchPypi, isPy27, python
|
2022-10-21 18:38:19 +00:00
|
|
|
, CoreFoundation, IOKit
|
2021-03-19 17:17:44 +00:00
|
|
|
, pytestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
, mock
|
2020-08-20 17:08:02 +00:00
|
|
|
, unittest2
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "psutil";
|
2022-09-30 11:47:45 +00:00
|
|
|
version = "5.9.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2022-09-30 11:47:45 +00:00
|
|
|
sha256 = "sha256-/rhhoQtsO7AHAQY7N+Svx1T4IX8PCcQigFhr1qxxK1w=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-05-28 09:39:13 +00:00
|
|
|
# We have many test failures on various parts of the package:
|
|
|
|
# - segfaults on darwin:
|
|
|
|
# https://github.com/giampaolo/psutil/issues/1715
|
|
|
|
# - swap (on linux) might cause test failures if it is fully used:
|
|
|
|
# https://github.com/giampaolo/psutil/issues/1911
|
|
|
|
# - some mount paths are required in the build sanbox to make the tests succeed:
|
|
|
|
# https://github.com/giampaolo/psutil/issues/1912
|
|
|
|
doCheck = false;
|
2021-03-19 17:17:44 +00:00
|
|
|
checkInputs = [ pytestCheckHook ]
|
2022-06-26 10:26:21 +00:00
|
|
|
++ lib.optionals isPy27 [ mock unittest2 ];
|
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 = [
|
|
|
|
"$out/${python.sitePackages}/psutil/tests/test_system.py"
|
|
|
|
];
|
2021-05-28 09:39:13 +00:00
|
|
|
|
|
|
|
# Note: $out must be referenced as test import paths are relative
|
2021-03-19 17:17:44 +00:00
|
|
|
disabledTests = [
|
|
|
|
"user"
|
|
|
|
"disk_io_counters"
|
|
|
|
"sensors_battery"
|
|
|
|
"cpu_times"
|
|
|
|
"cpu_freq"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-10-21 18:38:19 +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 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
pythonImportsCheck = [ "psutil" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Process and system utilization information interface for python";
|
|
|
|
homepage = "https://github.com/giampaolo/psutil";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ jonringer ];
|
|
|
|
};
|
|
|
|
}
|