diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-08-04 15:40:17 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-08-04 15:40:17 +1000 |
| commit | d8037819f01ef2eb920516ce50237a922019684b (patch) | |
| tree | 2353531ebe95a7ae69aaa5c77b767a3db7f737d9 /src/caelestia/utils/version.py | |
| parent | theme: add template system (#36) (diff) | |
| download | caelestia-cli-d8037819f01ef2eb920516ce50237a922019684b.tar.gz caelestia-cli-d8037819f01ef2eb920516ce50237a922019684b.tar.bz2 caelestia-cli-d8037819f01ef2eb920516ce50237a922019684b.zip | |
ci: add flake update workflow
Also add contributing, funding and issue templates
parser: add kill option to shell
version: fix errors when not on arch
Diffstat (limited to 'src/caelestia/utils/version.py')
| -rw-r--r-- | src/caelestia/utils/version.py | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/src/caelestia/utils/version.py b/src/caelestia/utils/version.py index 7c5ce88..5e75387 100644 --- a/src/caelestia/utils/version.py +++ b/src/caelestia/utils/version.py @@ -1,30 +1,42 @@ +import shutil import subprocess from caelestia.utils.paths import config_dir def print_version() -> None: - print("Packages:") - pkgs = ["caelestia-shell-git", "caelestia-cli-git", "caelestia-meta"] - versions = subprocess.run( - ["pacman", "-Q", *pkgs], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True - ).stdout + if shutil.which("pacman"): + print("Packages:") + pkgs = ["caelestia-shell-git", "caelestia-cli-git", "caelestia-meta"] + versions = subprocess.run( + ["pacman", "-Q", *pkgs], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, text=True + ).stdout - for pkg in pkgs: - if pkg not in versions: - print(f" {pkg} not installed") - print("\n".join(f" {pkg}" for pkg in versions.splitlines())) + for pkg in pkgs: + if pkg not in versions: + print(f" {pkg} not installed") + print("\n".join(f" {pkg}" for pkg in versions.splitlines())) + else: + print("Packages: not on Arch") - caelestia_dir = (config_dir / "hypr").resolve().parent - print("\nCaelestia:") - caelestia_ver = subprocess.check_output( - ["git", "--git-dir", caelestia_dir / ".git", "rev-list", "--format=%B", "--max-count=1", "HEAD"], text=True - ) - print(" Last commit:", caelestia_ver.split()[1]) - print(" Commit message:", *caelestia_ver.splitlines()[1:]) + print() + try: + caelestia_dir = (config_dir / "hypr").resolve().parent + caelestia_ver = subprocess.check_output( + ["git", "--git-dir", caelestia_dir / ".git", "rev-list", "--format=%B", "--max-count=1", "HEAD"], text=True + ) + print("Caelestia:") + print(" Last commit:", caelestia_ver.split()[1]) + print(" Commit message:", *caelestia_ver.splitlines()[1:]) + except subprocess.CalledProcessError: + print("Caelestia: not installed") - print("\nQuickshell:") - print(" ", subprocess.check_output(["qs", "--version"], text=True).strip()) + print() + if shutil.which("qs"): + print("Quickshell:") + print(" ", subprocess.check_output(["qs", "--version"], text=True).strip()) + else: + print("Quickshell: not in PATH") local_shell_dir = config_dir / "quickshell/caelestia" if local_shell_dir.exists(): |