Skip to content

Commit

Permalink
pep8
Browse files Browse the repository at this point in the history
  • Loading branch information
jessebot committed Nov 6, 2022
1 parent 3c17ca4 commit ce78b66
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 22 deletions.
6 changes: 2 additions & 4 deletions onboardme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
LICENSE: GNU AFFERO GENERAL PUBLIC LICENSE
"""
from click import option, command, Choice
import dbm
import importlib
import logging
import sys

# rich helps pretty print everything
from rich.console import Console
Expand All @@ -20,7 +18,7 @@
from .help_text import RichCommand, options_help
from .env_config import check_os_support, OS, process_configs, USR_CONFIG_FILE
from .env_config import DEFAULTS as OPTS
from .console_logging import print_panel, print_manual_steps
from .console_logging import print_manual_steps


HELP = options_help()
Expand Down Expand Up @@ -131,7 +129,7 @@ def main(log_level: str = "",

elif step in ['vim_setup', 'neovim_setup', 'font_setup']:
# import step from ide_setup.py in same directory
importlib.import_module(f'onboardme.ide_setup', package=f'.{step}')
importlib.import_module('onboardme.ide_setup', package=f'.{step}')
func = getattr(ide_setup, step)
func()

Expand Down
1 change: 1 addition & 0 deletions onboardme/config/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ pip3.10:
packages:
default:
# this is for python development
- flake8
- pip
- build
- twine
Expand Down
3 changes: 2 additions & 1 deletion onboardme/env_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def load_yaml(yaml_config_file=""):
# print(f"Config file we got was not present: {yaml_config_file}")
return None


# pathing
PWD = path.dirname(__file__)
HOME_DIR = getenv("HOME")
Expand Down Expand Up @@ -143,7 +144,7 @@ def process_configs(overwrite=False, repo="", git_branch="", pkg_mngrs=[],
extra={"markup": True})

usr_cfgs = fill_in_defaults(DEFAULTS, USR_CONFIG_FILE)
log.debug("after user_config_file filled in with defaults: " + \
log.debug("after user_config_file filled in with defaults: " +
f"{usr_cfgs}", extra={"markup": True})

final_defaults = fill_in_defaults(cli_dict, usr_cfgs, True)
Expand Down
4 changes: 2 additions & 2 deletions onboardme/help_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ class OptionHighlighter(RegexHighlighter):
desc = (
"[steel_blue]Get your daily driver just the way you like it, from "
"[b]text[/] [i]formatting[/], and dot files to opensource package "
"installation, onboardme intends to save you time with initializing"
" or upgrading your environment.")
"installation, onboardme intends to save you time with "
"initializing or upgrading your environment.")

console.print(title + desc, justify="center")

Expand Down
20 changes: 9 additions & 11 deletions onboardme/pkg_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

# custom libs
from .env_config import OS, PWD, load_yaml
from .console_logging import print_header, print_sub_header, print_msg
from .console_logging import print_header, print_msg
from .console_logging import print_sub_header as sub_header
from .subproc import subproc


Expand Down Expand Up @@ -37,7 +38,7 @@ def brew_install_upgrade(package_groups=['default']):

if os_brewfile:
os_msg = f'[b]{OS[0]}[/b] specific package installs...'
print_sub_header(os_msg)
sub_header(os_msg)
subproc([f'{install_cmd}{OS[0]}'], error_ok=True)
print_msg(f'{OS[0]} specific packages installed.')

Expand All @@ -47,12 +48,12 @@ def brew_install_upgrade(package_groups=['default']):
if group != "default" and path.exists(group_file):
# Installing devops specific brew app Installs/Upgrades
msg = f"{group.title()} specific package installs..."
print_sub_header(msg)
sub_header(msg)
subproc([f'{install_cmd}{group}'], error_ok=True)
print_msg(f'{group.title()} specific packages installed.')

# cleanup operation doesn't seem to happen automagically :shrug:
print_sub_header('[b]brew[/b] final cleanup')
sub_header('[b]brew[/b] final cleanup')
subproc(['brew cleanup'])
print_msg('Cleanup completed.')
return
Expand Down Expand Up @@ -102,26 +103,23 @@ def run_pkg_mngrs(pkg_mngrs=[], pkg_groups=[]):
if 'sudo' in pkg_cmds[pre_cmd]:
SPINNER = False
subproc([pkg_cmds[pre_cmd]], spinner=SPINNER)
print_sub_header(f"[b]{pre_cmd.title()}[/b] completed.")
sub_header(f"[b]{pre_cmd.title()}[/b] completed.")

# list of actually installed packages
installed_pkgs = subproc([pkg_cmds['list']], quiet=True)

for pkg_group in pkg_groups:
if pkg_group in required_pkg_groups:
if pkg_group != 'default':
# msg = (f"Installing [i]{pkg_group}[/i] packages")
# print_msg(msg)

install_pkg_group(installed_pkgs,
required_pkg_groups[pkg_group],
pkg_cmds['install'])

print_sub_header(f'{pkg_group.title()} packages installed.')
sub_header(f'{pkg_group.title()} packages installed.')

if 'cleanup' in pkg_cmds:
subproc([pkg_cmds['cleanup']])
print_sub_header("[b]Cleanup[/b] step Completed.")
sub_header("[b]Cleanup[/b] step Completed.")
#
return


Expand Down
5 changes: 2 additions & 3 deletions onboardme/subproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import logging as log
from subprocess import PIPE, Popen

from rich import print
from rich.console import Console


Expand All @@ -19,7 +18,7 @@ def subproc(commands=[], **kwargs):
spinner - show an animated progress spinner. can break sudo
prompts and should be turned off. Default: True
cwd - path to run commands in. Default: pwd of user
shell - use shell with subprocess or not. Default: False
shell - use shell with subprocess or not. Default: False
env - dictionary of env variables for BASH. Default: None
"""

Expand Down Expand Up @@ -60,7 +59,7 @@ def run_subprocess(command, **kwargs):
Optional keyword vars:
error_ok - bool, catch errors, defaults to False
cwd - str, current working dir which is the dir to run command in
shell - bool, run shell or not
shell - bool, run shell or not
env - environment variables you'd like to pass in
"""
# subprocess expects a list if there are spaces in the command
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def readme():
lic_class],
python_requires='>3.10',
keywords='onboardme, onboarding, desktop-setup, setuptools, development',
version='0.14.13_a9',
version='0.14.13_a10',
project_urls={
'Documentation': 'https://jessebot.github.io/onboardme/onboardme',
'Source': 'http://github.com/jessebot/onboardme',
Expand Down

0 comments on commit ce78b66

Please sign in to comment.