Merge pull request #115220 from bobrik/ivan/py-cpuinfo-sysctl

This commit is contained in:
Sandro 2021-03-06 14:56:40 +01:00 committed by GitHub
commit fe3df71968
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,7 +1,9 @@
{ lib
, stdenv
, fetchFromGitHub
, buildPythonPackage
, pytestCheckHook
, sysctl
}:
buildPythonPackage rec {
@ -15,6 +17,13 @@ buildPythonPackage rec {
sha256 = "10qfaibyb2syiwiyv74l7d97vnmlk079qirgnw3ncklqjs0s3gbi";
};
# On Darwin sysctl is used to read CPU information.
postPatch = lib.optionalString stdenv.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'"
'';
checkInputs = [
pytestCheckHook
];