forked from mirrors/nixpkgs
Merge pull request #139221 from figsoda/auto-cpufreq-version
auto-cpufreq: fix version output
This commit is contained in:
commit
860ca9fe49
|
@ -1,4 +1,4 @@
|
|||
{ lib, python3Packages, fetchFromGitHub }:
|
||||
{ lib, python3Packages, fetchFromGitHub, substituteAll }:
|
||||
|
||||
python3Packages.buildPythonPackage rec {
|
||||
pname = "auto-cpufreq";
|
||||
|
@ -16,8 +16,16 @@ python3Packages.buildPythonPackage rec {
|
|||
doCheck = false;
|
||||
pythonImportsCheck = [ "auto_cpufreq" ];
|
||||
|
||||
# patch to prevent script copying and to disable install
|
||||
patches = [ ./prevent-install-and-copy.patch ];
|
||||
patches = [
|
||||
# hardcodes version output
|
||||
(substituteAll {
|
||||
src = ./fix-version-output.patch;
|
||||
inherit version;
|
||||
})
|
||||
|
||||
# patch to prevent script copying and to disable install
|
||||
./prevent-install-and-copy.patch
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
# copy script manually
|
||||
|
|
37
pkgs/tools/system/auto-cpufreq/fix-version-output.patch
Normal file
37
pkgs/tools/system/auto-cpufreq/fix-version-output.patch
Normal file
|
@ -0,0 +1,37 @@
|
|||
--- a/auto_cpufreq/core.py
|
||||
+++ b/auto_cpufreq/core.py
|
||||
@@ -68,32 +68,8 @@ dist_name = distro.id()
|
||||
|
||||
# display running version of auto-cpufreq
|
||||
def app_version():
|
||||
-
|
||||
- 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"]:
|
||||
- aur_pkg_check = call("pacman -Qs auto-cpufreq > /dev/null", shell=True)
|
||||
- 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:
|
||||
- print(
|
||||
- "Git commit:",
|
||||
- check_output(["git", "describe", "--always"]).strip().decode(),
|
||||
- )
|
||||
- except Exception as e:
|
||||
- print(repr(e))
|
||||
- pass
|
||||
+ print("auto-cpufreq version: @version@")
|
||||
+ print("Git commit: v@version@")
|
||||
|
||||
|
||||
def app_res_use():
|
Loading…
Reference in a new issue