From 82b41f4ce2df75dd553d0aea19245c537c35c05e Mon Sep 17 00:00:00 2001 From: Adnan Hodzic Date: Sat, 6 Feb 2021 20:41:06 +0100 Subject: [PATCH] Improved auto-cpufreq version detection for aur package --- auto_cpufreq/core.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/auto_cpufreq/core.py b/auto_cpufreq/core.py index a5891c1..9b98b37 100644 --- a/auto_cpufreq/core.py +++ b/auto_cpufreq/core.py @@ -60,16 +60,19 @@ dist_name = distro.id() # display running version of auto-cpufreq def app_version(): + aur_pkg_check = call("pacman -Qs auto-cpufreq > /dev/null", shell=True) + print("auto-cpufreq version:") + # snap package if os.getenv('PKG_MARKER') == "SNAP": print(getoutput("echo Snap: $SNAP_VERSION")) # aur package elif dist_name in ["arch", "manjaro", "garuda"]: - try: - print("pacman -Qi auto-cpufreq* | grep Version") - except: - pass + if aur_pkg_check == 1: + print("Git commit:", check_output(["git", "describe", "--always"]).strip().decode()) + else: + print(getoutput("pacman -Qi auto-cpufreq* | grep Version")) else: # source code (auto-cpufreq-installer) try: