From 3c17ca49c7f38523f4cd194b9dfc583298363fd9 Mon Sep 17 00:00:00 2001 From: Jesse Hitch Date: Sun, 6 Nov 2022 21:52:32 +0100 Subject: [PATCH] add -y to apt autoremove to prevent lockup, and fix spinner variable on sudo cmds --- onboardme/config/packages.yml | 2 +- onboardme/pkg_management.py | 20 ++++++++------------ setup.py | 2 +- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/onboardme/config/packages.yml b/onboardme/config/packages.yml index d44176ae..463f2548 100644 --- a/onboardme/config/packages.yml +++ b/onboardme/config/packages.yml @@ -6,7 +6,7 @@ apt: update: "sudo apt-get update -y" upgrade: "sudo apt-get upgrade -y" install: "sudo apt-get install -y " - cleanup: "sudo apt-get autoremove" + cleanup: "sudo apt-get autoremove -y" packages: default: - terminator diff --git a/onboardme/pkg_management.py b/onboardme/pkg_management.py index 4c07bd26..9d95e52a 100755 --- a/onboardme/pkg_management.py +++ b/onboardme/pkg_management.py @@ -8,9 +8,6 @@ from .subproc import subproc -SPINNER = True - - def brew_install_upgrade(package_groups=['default']): """ Run the install/upgrade of packages managed by brew, also updates brew @@ -101,11 +98,11 @@ def run_pkg_mngrs(pkg_mngrs=[], pkg_groups=[]): log.debug(f"package manager commands are: {pkg_cmds}") for pre_cmd in ['setup', 'update', 'upgrade']: if pre_cmd in pkg_cmds: - print_sub_header(f"{pkg_mngr} [b]{pre_cmd}[/b] step") - if 'sudo' in pre_cmd: + SPINNER = True + if 'sudo' in pkg_cmds[pre_cmd]: SPINNER = False subproc([pkg_cmds[pre_cmd]], spinner=SPINNER) - print_msg(f"[b]{pre_cmd}[/b] step Completed.") + print_sub_header(f"[b]{pre_cmd.title()}[/b] completed.") # list of actually installed packages installed_pkgs = subproc([pkg_cmds['list']], quiet=True) @@ -113,20 +110,18 @@ def run_pkg_mngrs(pkg_mngrs=[], pkg_groups=[]): for pkg_group in pkg_groups: if pkg_group in required_pkg_groups: if pkg_group != 'default': - msg = (f"Installing [i]{pkg_group}[/i] {pkg_emoji} " - f"[b]{pkg_mngr}[/b] packages") - print_sub_header(msg) + # msg = (f"Installing [i]{pkg_group}[/i] packages") + # print_msg(msg) install_pkg_group(installed_pkgs, required_pkg_groups[pkg_group], pkg_cmds['install']) - f_msg = f'[green]{pkg_mngr}[/green] {pkg_group} ' - print_msg(f_msg + 'packages installed.') + print_sub_header(f'{pkg_group.title()} packages installed.') if 'cleanup' in pkg_cmds: subproc([pkg_cmds['cleanup']]) - print_msg("[b]Cleanup[/b] step Completed.") + print_sub_header("[b]Cleanup[/b] step Completed.") return @@ -135,6 +130,7 @@ def install_pkg_group(installed_pkgs=[], pkgs_to_install=[], install_cmd=""): installs packages if they are not already intalled with intall_cmd Returns True. """ + SPINNER = True install_pkg = False # the spinner status thing rich provides breaks with input if 'sudo' in install_cmd: diff --git a/setup.py b/setup.py index 809e90e2..a1eea8be 100644 --- a/setup.py +++ b/setup.py @@ -25,7 +25,7 @@ def readme(): lic_class], python_requires='>3.10', keywords='onboardme, onboarding, desktop-setup, setuptools, development', - version='0.14.13_a4', + version='0.14.13_a9', project_urls={ 'Documentation': 'https://jessebot.github.io/onboardme/onboardme', 'Source': 'http://github.com/jessebot/onboardme',