From ebffd2a2dd9fc1271de305fb273d6804cabe699e Mon Sep 17 00:00:00 2001 From: 2Shirt <1923621+2Shirt@users.noreply.github.com> Date: Mon, 14 May 2018 07:54:33 -0600 Subject: [PATCH] Added more missing file warnings * Part of the fix for #27 --- .bin/Scripts/functions/setup.py | 17 ++++++++++++++--- .bin/Scripts/install_sw_bundle.py | 10 +++++++--- .bin/Scripts/system_checklist.py | 2 +- .bin/Scripts/system_diagnostics.py | 2 +- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/.bin/Scripts/functions/setup.py b/.bin/Scripts/functions/setup.py index 8e873088..693e84a2 100644 --- a/.bin/Scripts/functions/setup.py +++ b/.bin/Scripts/functions/setup.py @@ -5,6 +5,12 @@ from functions.common import * # STATIC VARIABLES HKCU = winreg.HKEY_CURRENT_USER HKLM = winreg.HKEY_LOCAL_MACHINE +OTHER_RESULTS = { + 'Error': { + 'CalledProcessError': 'Unknown Error', + 'FileNotFoundError': 'File not found', + }, + 'Warning': {}} SETTINGS_CLASSIC_START = { r'Software\IvoSoft\ClassicShell\Settings': {}, r'Software\IvoSoft\ClassicStartMenu': { @@ -212,7 +218,7 @@ def install_adobe_reader(): '/msi', '/norestart', '/quiet', 'ALLUSERS=1', 'EULA_ACCEPT=YES'] - try_and_print(message='Adobe Reader DC...', function=run_program, cmd=cmd) + run_program(cmd) def install_chrome_extensions(): """Update registry to 'install' Google Chrome extensions for all users.""" @@ -235,12 +241,16 @@ def install_firefox_extensions(): """Extract Firefox extensions to installation folder.""" dist_path = r'{PROGRAMFILES}\Mozilla Firefox\distribution\extensions'.format( **global_vars['Env']) + source_path = r'{CBinDir}\FirefoxExtensions.7z'.format(**global_vars) + if not os.path.exists(source_path): + raise FileNotFoundError + # Extract extension(s) to distribution folder cmd = [ global_vars['Tools']['SevenZip'], 'x', '-aos', '-bso0', '-bse0', '-p{ArchivePassword}'.format(**global_vars), '-o{dist_path}'.format(dist_path=dist_path), - r'{CBinDir}\FirefoxExtensions.7z'.format(**global_vars)] + source_path] run_program(cmd) def install_ninite_bundle(mse=False): @@ -264,7 +274,8 @@ def install_vcredists(): prev_dir = os.getcwd() os.chdir(r'{BinDir}\_vcredists'.format(**global_vars)) for vcr in VCR_REDISTS: - try_and_print(message=vcr['Name'], function=run_program, cmd=vcr['Cmd']) + try_and_print(message=vcr['Name'], function=run_program, + cmd=vcr['Cmd'], other_results=OTHER_RESULTS) os.chdir(prev_dir) diff --git a/.bin/Scripts/install_sw_bundle.py b/.bin/Scripts/install_sw_bundle.py index 9f8594b0..d98eb8d2 100644 --- a/.bin/Scripts/install_sw_bundle.py +++ b/.bin/Scripts/install_sw_bundle.py @@ -19,6 +19,7 @@ if __name__ == '__main__': other_results = { 'Error': { 'CalledProcessError': 'Unknown Error', + 'FileNotFoundError': 'File not found', }, 'Warning': { 'GenericRepair': 'Repaired', @@ -36,12 +37,14 @@ if __name__ == '__main__': print_info('Installing Programs') if answer_adobe_reader: - install_adobe_reader() + try_and_print(message='Adobe Reader DC...', + function=install_adobe_reader, other_results=other_results) if answer_vcr: install_vcredists() if answer_ninite: try_and_print(message='Ninite bundle...', - function=install_ninite_bundle, cs='Started', mse=answer_mse) + function=install_ninite_bundle, cs='Started', + mse=answer_mse, other_results=other_results) if answer_extensions: wait_for_process('ninite.exe') print_info('Installing Extensions') @@ -51,7 +54,8 @@ if __name__ == '__main__': try_and_print(message='Google Chrome extensions...', function=install_chrome_extensions) try_and_print(message='Mozilla Firefox extensions...', - function=install_firefox_extensions) + function=install_firefox_extensions, + other_results=other_results) print_standard('\nDone.') exit_script() except SystemExit: diff --git a/.bin/Scripts/system_checklist.py b/.bin/Scripts/system_checklist.py index e3eca0bf..6e0a1fcb 100644 --- a/.bin/Scripts/system_checklist.py +++ b/.bin/Scripts/system_checklist.py @@ -26,7 +26,7 @@ if __name__ == '__main__': 'Error': { 'CalledProcessError': 'Unknown Error', 'BIOSKeyNotFoundError': 'BIOS key not found', - 'FileNotFoundError': 'Program not found', + 'FileNotFoundError': 'File not found', }, 'Warning': {}} print_info('Starting System Checklist for Ticket #{}\n'.format( diff --git a/.bin/Scripts/system_diagnostics.py b/.bin/Scripts/system_diagnostics.py index 3b1418d0..59e31465 100644 --- a/.bin/Scripts/system_diagnostics.py +++ b/.bin/Scripts/system_diagnostics.py @@ -25,7 +25,7 @@ if __name__ == '__main__': other_results = { 'Error': { 'CalledProcessError': 'Unknown Error', - 'FileNotFoundError': 'Program not found', + 'FileNotFoundError': 'File not found', }, 'Warning': { 'GenericRepair': 'Repaired',