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