mirror of
https://github.com/AdnanHodzic/auto-cpufreq.git
synced 2025-07-27 07:34:25 +02:00
added inxi into snap. (#78)
* added inxi into snap. * remove errors for inxi that occurs in snap env
This commit is contained in:
parent
35d6cb6519
commit
6a633a7e52
@ -19,6 +19,8 @@ parts:
|
|||||||
- gcc
|
- gcc
|
||||||
- python3-dev
|
- python3-dev
|
||||||
- python3-wheel
|
- python3-wheel
|
||||||
|
stage-packages:
|
||||||
|
- inxi
|
||||||
source: .
|
source: .
|
||||||
|
|
||||||
deploy-cpufrectl:
|
deploy-cpufrectl:
|
||||||
|
@ -60,15 +60,20 @@ def get_sys_info():
|
|||||||
Return sys info of inxi command with injected governors information
|
Return sys info of inxi command with injected governors information
|
||||||
"""
|
"""
|
||||||
govs = " ".join(get_avail_gov())
|
govs = " ".join(get_avail_gov())
|
||||||
govs = f"Governors: {govs}"
|
|
||||||
if shutil.which("inxi") is not None:
|
if shutil.which("inxi") is not None:
|
||||||
sys_info = getoutput("inxi -Fz")
|
sys_info = getoutput("inxi -Fzc0")
|
||||||
p = re.compile(pattern=r".*(CPU:\s+).+", flags=re.MULTILINE)
|
f = re.MULTILINE | re.DOTALL
|
||||||
indent = " " * len(p.search(sys_info).group(1))
|
|
||||||
sys_info = p.sub(f"CPU:{indent[4:]}{govs}", sys_info)
|
# remove errors at the beginning that could occur in the snap container
|
||||||
|
sys_info = re.fullmatch(r"(.*)(System:.*)", sys_info, flags=f).group(2)
|
||||||
|
|
||||||
|
# insert governors after "CPU:"
|
||||||
|
p = re.compile(pattern=r"(.*)(CPU:)(\s+)(.+)", flags=f)
|
||||||
|
indent = " " * len(p.search(sys_info).group(3))
|
||||||
|
sys_info = p.sub(fr"\1\2{indent}Governors: {govs}\4", sys_info)
|
||||||
else:
|
else:
|
||||||
sys_info = ("Warning: inxi is not installed.\n"
|
sys_info = ("Warning: inxi is not installed.\n"
|
||||||
f"{govs}")
|
f"Governors: {govs}\n")
|
||||||
|
|
||||||
return sys_info
|
return sys_info
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user