at 24.11-pre 2.3 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 CoreFoundation, 6 fetchPypi, 7 IOKit, 8 pytestCheckHook, 9 python, 10 pythonOlder, 11}: 12 13buildPythonPackage rec { 14 pname = "psutil"; 15 version = "5.9.8"; 16 format = "setuptools"; 17 18 inherit stdenv; 19 20 disabled = pythonOlder "3.7"; 21 22 src = fetchPypi { 23 inherit pname version; 24 hash = "sha256-a+Em4yJUht/yhqj7mgYkalJT9MfFO0depfWsk05kGUw="; 25 }; 26 27 postPatch = '' 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 33 ''; 34 35 buildInputs = 36 # workaround for https://github.com/NixOS/nixpkgs/issues/146760 37 lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ CoreFoundation ] 38 ++ lib.optionals stdenv.isDarwin [ IOKit ]; 39 40 nativeCheckInputs = [ pytestCheckHook ]; 41 42 # Segfaults on darwin: 43 # https://github.com/giampaolo/psutil/issues/1715 44 doCheck = !stdenv.isDarwin; 45 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) 50 pytestFlagsArray = [ 51 # Note: $out must be referenced as test import paths are relative 52 "$out/${python.sitePackages}/psutil/tests/test_system.py" 53 ]; 54 55 disabledTests = [ 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. 59 "cpu_freq" 60 "cpu_times" 61 "disk_io_counters" 62 "sensors_battery" 63 "sensors_temperatures" 64 "user" 65 "test_disk_partitions" # problematic on Hydra's Linux builders, apparently 66 ]; 67 68 pythonImportsCheck = [ "psutil" ]; 69 70 meta = with lib; { 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; 75 maintainers = with maintainers; [ jonringer ]; 76 }; 77}