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