Skip to content

Commit

Permalink
Merge branch 'master' into config-update
Browse files Browse the repository at this point in the history
  • Loading branch information
shadeyg56 committed Apr 18, 2024
2 parents bc99a28 + 5e17ee3 commit e540121
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 22 deletions.
7 changes: 7 additions & 0 deletions auto_cpufreq/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,20 @@ def turbo(value: bool = None):
"""
p_state = Path("/sys/devices/system/cpu/intel_pstate/no_turbo")
cpufreq = Path("/sys/devices/system/cpu/cpufreq/boost")
amd_pstate = Path("/sys/devices/system/cpu/amd_pstate/status")

if p_state.exists():
inverse = True
f = p_state
elif cpufreq.exists():
f = cpufreq
inverse = False
elif amd_pstate.exists():
amd_value = amd_pstate.read_text().strip()
if amd_value == "active":
print("CPU turbo is controlled by amd-pstate-epp driver")
# Basically, no other value should exist.
return False
else:
print("Warning: CPU turbo is not available")
return False
Expand Down
13 changes: 12 additions & 1 deletion nix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@
lib,
python310Packages,
pkgs,
fetchFromGitHub,
}:
let
psutilGit = python310Packages.psutil.overrideAttrs (oldAttrs: {
src = fetchFromGitHub {
owner = "giampaolo";
repo = "psutil";
rev = "4cf56e08c1bc883ec89758834b50954380759858";
sha256 = "61JwXP/cZrXqdBnb2J0kdDJoKpltO62KcpM0sYX6g1A=";
};
});
in
python310Packages.buildPythonPackage {
# use pyproject.toml instead of setup.py
format = "pyproject";
Expand All @@ -15,7 +26,7 @@ python310Packages.buildPythonPackage {

buildInputs = with pkgs; [gtk3 python310Packages.poetry-core];

propagatedBuildInputs = with python310Packages; [requests pygobject3 click distro psutil setuptools poetry-dynamic-versioning pyinotify];
propagatedBuildInputs = with python310Packages; [requests pygobject3 click distro psutilGit setuptools poetry-dynamic-versioning pyinotify];

doCheck = false;
pythonImportsCheck = ["auto_cpufreq"];
Expand Down
32 changes: 12 additions & 20 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ packages = [

[tool.poetry.dependencies]
python = "^3.8"
psutil = "^5.9.5"
psutil = {git = "https://github.com/giampaolo/psutil.git", rev = "4cf56e08c1bc883ec89758834b50954380759858"}
click = "^8.1.0"
distro = "^1.8.0"
requests = "^2.31.0"
Expand Down

0 comments on commit e540121

Please sign in to comment.