13 buildPythonPackage rec {
16 format = "setuptools";
20 disabled = pythonOlder "3.7";
23 inherit pname version;
24 hash = "sha256-j6rk8xC22Wn6JsoFRTOLIfc8axXbfEqNk0pUgvqoGPI=";
28 # stick to the old SDK name for now
29 # https://developer.apple.com/documentation/iokit/kiomasterportdefault/
30 # https://developer.apple.com/documentation/iokit/kiomainportdefault/
31 substituteInPlace psutil/arch/osx/cpu.c \
32 --replace-fail kIOMainPortDefault kIOMasterPortDefault
36 # workaround for https://github.com/NixOS/nixpkgs/issues/146760
37 lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [ CoreFoundation ]
38 ++ lib.optionals stdenv.hostPlatform.isDarwin [ IOKit ];
40 nativeCheckInputs = [ pytestCheckHook ];
42 # Segfaults on darwin:
43 # https://github.com/giampaolo/psutil/issues/1715
44 doCheck = !stdenv.hostPlatform.isDarwin;
46 # In addition to the issues listed above there are some that occure due to
47 # our sandboxing which we can work around by disabling some tests:
48 # - cpu_times was flaky on darwin
49 # - the other disabled tests are likely due to sanboxing (missing specific errors)
51 # Note: $out must be referenced as test import paths are relative
52 "${placeholder "out"}/${python.sitePackages}/psutil/tests/test_system.py"
56 # Some of the tests have build-system hardware-based impurities (like
57 # reading temperature sensor values). Disable them to avoid the failures
58 # that sometimes result.
63 "sensors_temperatures"
65 "test_disk_partitions" # problematic on Hydra's Linux builders, apparently
68 pythonImportsCheck = [ "psutil" ];
71 description = "Process and system utilization information interface";
72 homepage = "https://github.com/giampaolo/psutil";
73 changelog = "https://github.com/giampaolo/psutil/blob/release-${version}/HISTORY.rst";
74 license = licenses.bsd3;