1{ lib 2, stdenv 3, buildPythonPackage 4, fetchFromGitHub 5, pytestCheckHook 6, pythonOlder 7, sysctl 8}: 9 10buildPythonPackage rec { 11 pname = "py-cpuinfo"; 12 version = "9.0.0"; 13 format = "setuptools"; 14 15 disabled = pythonOlder "3.7"; 16 17 src = fetchFromGitHub { 18 owner = "workhorsy"; 19 repo = pname; 20 rev = "v${version}"; 21 hash = "sha256-Q5u0guAqDVhf6bvJTzNvCpWbIzjxxAjE7s0OuXj9T4Q="; 22 }; 23 24 checkInputs = [ 25 pytestCheckHook 26 ]; 27 28 # On Darwin sysctl is used to read CPU information. 29 postPatch = lib.optionalString stdenv.isDarwin '' 30 substituteInPlace cpuinfo/cpuinfo.py \ 31 --replace "len(_program_paths('sysctl')) > 0" "True" \ 32 --replace "_run_and_get_stdout(['sysctl'" "_run_and_get_stdout(['${sysctl}/bin/sysctl'" 33 ''; 34 35 pythonImportsCheck = [ 36 "cpuinfo" 37 ]; 38 39 meta = with lib; { 40 description = "Get CPU info with pure Python"; 41 longDescription = '' 42 Py-cpuinfo gets CPU info with pure Python and should work without any 43 extra programs or libraries, beyond what your OS provides. It does not 44 require any compilation (C/C++, assembly, etc.) to use and works with 45 Python. 46 ''; 47 homepage = "https://github.com/workhorsy/py-cpuinfo"; 48 changelog = "https://github.com/workhorsy/py-cpuinfo/blob/v${version}/ChangeLog"; 49 license = licenses.mit; 50 maintainers = with maintainers; [ costrouc ]; 51 }; 52}