summary refs log tree commit diff
path: root/pkgs/development/python-modules/py-cpuinfo
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2021-03-06 19:56:45 +0100
committerJan Tojnar <jtojnar@gmail.com>2021-03-06 19:56:45 +0100
commit1465e8e397ebd48bac55cc99548b7c3386ae005c (patch)
tree7d7b29a3d9b5a207c76098adf70cd91f9814a32e /pkgs/development/python-modules/py-cpuinfo
parentf5a7d8bb41bf5240e9b4ebdf4fd2cd8e006b60b1 (diff)
parent909c7c15d573bb66d94a0935da6858a0a282a48a (diff)
downloadnixpkgs-1465e8e397ebd48bac55cc99548b7c3386ae005c.tar
nixpkgs-1465e8e397ebd48bac55cc99548b7c3386ae005c.tar.gz
nixpkgs-1465e8e397ebd48bac55cc99548b7c3386ae005c.tar.bz2
nixpkgs-1465e8e397ebd48bac55cc99548b7c3386ae005c.tar.lz
nixpkgs-1465e8e397ebd48bac55cc99548b7c3386ae005c.tar.xz
nixpkgs-1465e8e397ebd48bac55cc99548b7c3386ae005c.tar.zst
nixpkgs-1465e8e397ebd48bac55cc99548b7c3386ae005c.zip
Merge branch 'staging-next' into staging
Diffstat (limited to 'pkgs/development/python-modules/py-cpuinfo')
-rw-r--r--pkgs/development/python-modules/py-cpuinfo/default.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/py-cpuinfo/default.nix b/pkgs/development/python-modules/py-cpuinfo/default.nix
index 66344cf84f2..f9e276b3bb5 100644
--- a/pkgs/development/python-modules/py-cpuinfo/default.nix
+++ b/pkgs/development/python-modules/py-cpuinfo/default.nix
@@ -1,8 +1,10 @@
 { lib
+, stdenv
 , fetchFromGitHub
 , fetchpatch
 , buildPythonPackage
 , pytestCheckHook
+, sysctl
 }:
 
 buildPythonPackage rec {
@@ -33,6 +35,13 @@ buildPythonPackage rec {
     pytestCheckHook
   ];
 
+  # 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'"
+  '';
+
   meta = {
     description = "Get CPU info with pure Python 2 & 3";
     longDescription = ''