minor code improvements/clean-up

This commit is contained in:
Adnan Hodzic 2020-01-26 17:45:11 +01:00
parent e3b207795b
commit 8a06de40cd
3 changed files with 5 additions and 14 deletions

1
.gitignore vendored
View File

@ -26,6 +26,7 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
files.txt
# PyInstaller
# Usually these files are written by a python script from a template

View File

@ -25,12 +25,7 @@ def main(monitor, live, daemon, install, log):
print("\nExample usage:\nauto-cpufreq --monitor")
print("\n-----\n")
# ToDo: add option what to run depending on the env
if os.getenv('PKG_MARKER') == "SNAP":
s.call(["auto-cpufreq", "--help"])
else:
s.call(["python3", "auto-cpufreq", "--help"])
#s.call([tool_run, " --help"])
s.call(["auto-cpufreq", "--help"])
footer(79)
else:
if daemon:

View File

@ -21,7 +21,6 @@ import signal
p = psutil
pl = platform
s = subprocess
tool_run = sys.argv[0]
cpus = os.cpu_count()
# get turbo boost state
@ -73,14 +72,9 @@ def deploy():
except:
print("\nERROR:\nWas unable to turn off bluetooth on boot")
#print("\n* Deploy auto-cpufreq as system wide accessible binary")
#os.system("cp auto-cpufreq /usr/bin/auto-cpufreq")
# create log file
create_file(auto_cpufreq_log_file)
# sudo python3 setup.py install --record files.txt
print("\n* Deploy auto-cpufreq install script")
os.system("cp /usr/local/share/auto-cpufreq/scripts/auto-cpufreq-install.sh /usr/bin/auto-cpufreq-install")
@ -135,7 +129,8 @@ def gov_check():
def root_check():
if not os.geteuid() == 0:
print("\n" + "-" * 33 + " Root check " + "-" * 34 + "\n")
sys.exit("ERROR:\n\nMust be run root for this functionality to work, i.e: \nsudo " + tool_run + "\n")
print("ERROR:\n\nMust be run root for this functionality to work, i.e: \nsudo auto-cpufreq")
footer(79)
exit(1)
# refresh countdown
@ -384,7 +379,7 @@ def read_log():
s.call(["tail", "-n 50", "-f", auto_cpufreq_log_file])
else:
print("\n" + "-" * 30 + " auto-cpufreq log " + "-" * 31 + "\n")
print("ERROR: auto-cpufreq log is missing.\n\nMake sure to run: \"python3 auto-cpufreq.py --install\" first")
print("ERROR: auto-cpufreq log is missing.\n\nMake sure to run: \"auto-cpufreq --install\" first")
footer(79)
def running_check():