2020-02-22 04:22:10 +00:00
|
|
|
{ lib, stdenv, buildPythonPackage, fetchPypi, isPy27, python
|
2017-11-23 15:59:42 +00:00
|
|
|
, darwin
|
2020-02-22 04:22:10 +00:00
|
|
|
, pytest
|
|
|
|
, mock
|
|
|
|
, ipaddress
|
2020-08-04 10:15:12 +01:00
|
|
|
, unittest2
|
2017-11-23 15:59:42 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "psutil";
|
2020-10-25 09:06:55 +00:00
|
|
|
version = "5.7.3";
|
2017-11-23 15:59:42 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2020-10-25 09:06:55 +00:00
|
|
|
sha256 = "af73f7bcebdc538eda9cc81d19db1db7bf26f103f91081d780bbacfcb620dee2";
|
2017-11-23 15:59:42 +00:00
|
|
|
};
|
|
|
|
|
2020-02-22 04:22:10 +00:00
|
|
|
# arch doesn't report frequency is the same way
|
2020-03-14 01:20:20 +00:00
|
|
|
# tests segfaults on darwin https://github.com/giampaolo/psutil/issues/1715
|
2020-06-19 20:03:41 +01:00
|
|
|
doCheck = !stdenv.isDarwin && stdenv.isx86_64;
|
2020-02-22 04:22:10 +00:00
|
|
|
checkInputs = [ pytest ]
|
2020-08-04 10:15:12 +01:00
|
|
|
++ lib.optionals isPy27 [ mock ipaddress unittest2 ];
|
2020-02-22 04:22:10 +00: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 \
|
2020-08-16 20:53:08 +01:00
|
|
|
-k 'not user and not disk_io_counters and not sensors_battery and not cpu_times'
|
2020-02-22 04:22:10 +00:00
|
|
|
'';
|
2017-11-23 15:59:42 +00:00
|
|
|
|
2020-02-22 04:22:10 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ darwin.IOKit ];
|
2017-11-23 15:59:42 +00:00
|
|
|
|
2020-02-22 04:22:10 +00:00
|
|
|
pythonImportsCheck = [ "psutil" ];
|
|
|
|
|
|
|
|
meta = with lib; {
|
2017-11-23 15:59:42 +00:00
|
|
|
description = "Process and system utilization information interface for python";
|
2020-02-22 04:22:10 +00:00
|
|
|
homepage = "https://github.com/giampaolo/psutil";
|
|
|
|
license = licenses.bsd3;
|
|
|
|
maintainers = with maintainers; [ jonringer ];
|
2017-11-23 15:59:42 +00:00
|
|
|
};
|
|
|
|
}
|