Refactor formatting in update.py for improved readability
All checks were successful
Ansible Lint Check / check-ansible (push) Successful in 3s
Nix Format Check / check-format (push) Successful in 1m13s
Python Lint Check / check-python (push) Successful in 6s

This commit is contained in:
2025-09-24 18:40:25 +02:00
parent 78f3133a1d
commit e494369d11

View File

@@ -31,7 +31,9 @@ def help_message():
" --full-speed, -F Upgrade packages and use all available cores for compilation. (Default: 8 cores)",
)
printfe("green", " --skip-check, -s Skip checking for dotfiles updates.")
printfe("green", " --system, -S Update system packages (flatpak, brew, apt, etc.)")
printfe(
"green", " --system, -S Update system packages (flatpak, brew, apt, etc.)"
)
printfe("green", " --help, -h Display this help message.")
return 0
@@ -246,10 +248,10 @@ def get_sudo_password_from_1password(username, hostname):
def get_distro():
"""Detect the Linux distribution."""
try:
with open('/etc/os-release', 'r') as f:
with open("/etc/os-release", "r") as f:
for line in f:
if line.startswith('ID='):
return line.split('=', 1)[1].strip().strip('"').lower()
if line.startswith("ID="):
return line.split("=", 1)[1].strip().strip('"').lower()
except:
return None
@@ -296,7 +298,9 @@ def update_system_packages(sudo_password):
full_cmd = sudo_cmd + cmd
printfe("cyan", f"Running: {' '.join(full_cmd)}")
if sudo_password:
result = subprocess.run(full_cmd, input=sudo_password + "\n", text=True, check=False)
result = subprocess.run(
full_cmd, input=sudo_password + "\n", text=True, check=False
)
else:
result = subprocess.run(full_cmd, check=False)
if result.returncode != 0: