nixpkgs/pkgs/development/python-modules/psutil/default.nix

42 lines
1.2 KiB
Nix
Raw Normal View History

2020-02-22 07:22:10 +03:00
{ lib, stdenv, buildPythonPackage, fetchPypi, isPy27, python
, darwin
2020-02-22 07:22:10 +03:00
, pytest
, mock
, ipaddress
2020-08-04 12:15:12 +03:00
, unittest2
}:
buildPythonPackage rec {
pname = "psutil";
2020-07-31 11:56:43 +03:00
version = "5.7.2";
src = fetchPypi {
inherit pname version;
2020-07-31 11:56:43 +03:00
sha256 = "90990af1c3c67195c44c9a889184f84f5b2320dce3ee3acbd054e3ba0b4a7beb";
};
2020-02-22 07:22:10 +03:00
# arch doesn't report frequency is the same way
# tests segfaults on darwin https://github.com/giampaolo/psutil/issues/1715
doCheck = !stdenv.isDarwin && stdenv.isx86_64;
2020-02-22 07:22:10 +03:00
checkInputs = [ pytest ]
2020-08-04 12:15:12 +03:00
++ lib.optionals isPy27 [ mock ipaddress unittest2 ];
2020-02-22 07:22:10 +03:00
# out must be referenced as test import paths are relative
# disable tests which don't work in sandbox
# cpu_times is flakey on darwin
checkPhase = ''
pytest $out/${python.sitePackages}/psutil/tests/test_system.py \
-k 'not user and not disk_io_counters and not sensors_battery and not cpu_times'
2020-02-22 07:22:10 +03:00
'';
2020-02-22 07:22:10 +03:00
buildInputs = lib.optionals stdenv.isDarwin [ darwin.IOKit ];
2020-02-22 07:22:10 +03:00
pythonImportsCheck = [ "psutil" ];
meta = with lib; {
description = "Process and system utilization information interface for python";
2020-02-22 07:22:10 +03:00
homepage = "https://github.com/giampaolo/psutil";
license = licenses.bsd3;
maintainers = with maintainers; [ jonringer ];
};
}