diff --git a/onboardme/config/onboardme_config.yml b/onboardme/config/onboardme_config.yml index 75c0ddd4..7c54ab84 100644 --- a/onboardme/config/onboardme_config.yml +++ b/onboardme/config/onboardme_config.yml @@ -60,9 +60,9 @@ package: Linux: - brew - pip3.10 + - apt - snap - flatpak - - apt # list of extra existing packages groups to install groups: - default diff --git a/onboardme/env_config.py b/onboardme/env_config.py index aa879ad5..5c501f99 100755 --- a/onboardme/env_config.py +++ b/onboardme/env_config.py @@ -4,11 +4,8 @@ from os import getenv, path, uname # rich helps pretty print everything from rich.prompt import Confirm -from rich.logging import RichHandler from .console_logging import print_panel import yaml -# this is the only logger that needs to updated manually if you are -# troubleshooting. set to logging.DEBUG to see errors def load_yaml(yaml_config_file=""): @@ -87,6 +84,19 @@ def process_steps(steps=[], firewall=False, browser=False): return result_steps +def sort_pkgmngrs(package_managers_list=[]): + """ + make sure the package managers are in the right order 🤦 + """ + final_list = [] + package_managers = ['brew', 'pip3.10', 'apt', 'snap', 'flatpak'] + for mngr in package_managers: + if mngr in package_managers_list: + final_list.append(mngr) + + return final_list + + def fill_in_defaults(defaults={}, user_config={}, always_prefer_default=False): """ Compares/Combines a default dict and another dict. Prefer default values @@ -146,5 +156,7 @@ def process_configs(overwrite=False, repo="", git_branch="", pkg_mngrs=[], valid_steps = process_steps(final_defaults['steps'][OS[0]], final_defaults['remote_hosts']) final_defaults['steps'][OS[0]] = valid_steps + sorted_mngrs = sort_pkgmngrs(final_defaults['package']['managers'][OS[0]]) + final_defaults['package']['managers'][OS[0]] = sorted_mngrs return final_defaults diff --git a/onboardme/ide_setup.py b/onboardme/ide_setup.py index 1159f6e2..6053c1e0 100644 --- a/onboardme/ide_setup.py +++ b/onboardme/ide_setup.py @@ -6,6 +6,7 @@ LICENSE: GNU AFFERO GENERAL PUBLIC LICENSE """ +import logging as log from git import Repo, RemoteProgress from os import path from pathlib import Path @@ -28,7 +29,8 @@ def vim_setup(): # trick to not run youcompleteme init every single time init_ycm = False - if not path.exists(f'{HOME_DIR}/.vim/plugged/YouCompleteMe/install.py'): + ycm_dir = path.join(HOME_DIR, '.vim/plugged/YouCompleteMe/install.sh') + if not path.exists(ycm_dir): init_ycm = True # this is for installing vim-plug @@ -48,7 +50,7 @@ def vim_setup(): if init_ycm: # This is for you complete me, which is a python completion module - subproc(f'{HOME_DIR}/.vim/plugged/YouCompleteMe/install.py') + subproc(ycm_dir) return True diff --git a/onboardme/pkg_management.py b/onboardme/pkg_management.py index 9501e336..77fa253f 100755 --- a/onboardme/pkg_management.py +++ b/onboardme/pkg_management.py @@ -1,4 +1,5 @@ #!/usr/bin/env python3.10 +import logging as log from os import path # custom libs @@ -57,16 +58,16 @@ def run_pkg_mngrs(pkg_mngrs=[], pkg_groups=[]): list passed in, only use brew/pip3.10 for mac. Takes optional variable, pkg_group_lists to install optional packages. """ - # brew has a special flow with brew files - if 'brew' in pkg_mngrs: - brew_install_upgrade(OS[0], pkg_groups) - pkg_mngrs.remove('brew') - - pkg_mngrs_list = load_yaml(f'{PWD}/config/packages.yml') - - # just in case we got any duplicates, we iterate through pkg_mngrs as a set - for pkg_mngr in set(pkg_mngrs): - pkg_mngr_dict = pkg_mngrs_list[pkg_mngr] + pkg_mngrs_list_of_dicts = load_yaml(path.join(PWD, 'config/packages.yml')) + log.debug(f"pkg_mngrs: {pkg_mngrs}", extra={"markup": True}) + + # we iterate through pkg_mngrs which should already be sorted + for pkg_mngr in pkg_mngrs: + # brew has a special flow with "Brewfile"s + if pkg_mngr == 'brew': + brew_install_upgrade(OS[0], pkg_groups) + continue + pkg_mngr_dict = pkg_mngrs_list_of_dicts[pkg_mngr] pkg_emoji = pkg_mngr_dict['emoji'] msg = f'{pkg_emoji} [green][b]{pkg_mngr}[/b][/] app Installs' print_header(msg) @@ -75,7 +76,7 @@ def run_pkg_mngrs(pkg_mngrs=[], pkg_groups=[]): pkg_cmds = pkg_mngr_dict['commands'] for pre_cmd in ['setup', 'update', 'upgrade']: if pre_cmd in pkg_cmds: - subproc([pkg_cmds[pre_cmd]], spinner=False) + subproc([pkg_cmds[pre_cmd]], spinner=False) # list of actually installed packages installed_pkgs = subproc([pkg_cmds['list']], quiet=True) diff --git a/setup.py b/setup.py index 0585a134..49828564 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.13.12', + version='0.14.8', project_urls={ 'Documentation': 'https://jessebot.github.io/onboardme/onboardme', 'Source': 'http://github.com/jessebot/onboardme',