From 6250ee8865ad893dceaac0fc679f6f3322e4013d Mon Sep 17 00:00:00 2001 From: Alan Mason <1923621+2Shirt@users.noreply.github.com> Date: Wed, 22 Nov 2017 20:56:26 -0800 Subject: [PATCH] Copy Ninite files to Installers during update --- .bin/Scripts/functions/update.py | 26 ++++++++++++++++++++++++++ .bin/Scripts/update_kit.py | 10 +--------- 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.bin/Scripts/functions/update.py b/.bin/Scripts/functions/update.py index 0f71a393..104818d5 100644 --- a/.bin/Scripts/functions/update.py +++ b/.bin/Scripts/functions/update.py @@ -597,6 +597,32 @@ def update_vcredists(): 'vcredist.exe', VCREDIST_SOURCES[year][bit]) +def update_one_ninite(section, dest, name, url, indent=8, width=40): + # Prep + url = 'https://ninite.com/{}/ninite.exe'.format(url) + + # Download + download_generic(out_dir=dest, out_name=name, source_url=url) + + # Copy to Installers folder + installer_parent = r'{}\Installers\Extras\{}'.format( + global_vars['BaseDir'], section) + installer_dest = r'{}\{}'.format(installer_parent, name) + os.makedirs(installer_parent, exist_ok=True) + if os.path.exists(installer_dest): + remove_item(installer_dest) + shutil.copy(r'{}\{}'.format(dest, name), installer_dest) + +def update_all_ninite(indent=8, width=40, other_results={}): + print_info('{}Ninite'.format(' '*int(indent/2))) + for section in sorted(NINITE_SOURCES.keys()): + print_success('{}{}'.format(' '*int(indent/4*3), section)) + dest = r'{}\_Ninite\{}'.format(global_vars['CBinDir'], section) + for name, url in sorted(NINITE_SOURCES[section].items()): + try_and_print(message=name, function=update_one_ninite, + other_results=other_results, indent=indent, width=width, + section=section, dest=dest, name=name, url=url) + ## Misc ## def update_caffeine(): # Stop running processes diff --git a/.bin/Scripts/update_kit.py b/.bin/Scripts/update_kit.py index d2ab9c37..30b4692c 100644 --- a/.bin/Scripts/update_kit.py +++ b/.bin/Scripts/update_kit.py @@ -60,15 +60,7 @@ if __name__ == '__main__': try_and_print(message='Adobe Reader DC...', function=update_adobe_reader_dc, other_results=other_results, width=40) try_and_print(message='MS Office...', function=update_office, other_results=other_results, width=40) try_and_print(message='Visual C++ Runtimes...', function=update_vcredists, other_results=other_results, width=40) - print_info(' Ninite') - for section in sorted(NINITE_SOURCES.keys()): - print_success(' {}'.format(section)) - dest = r'{}\_Ninite\{}'.format(global_vars['CBinDir'], section) - for name, url in sorted(NINITE_SOURCES[section].items()): - url = 'https://ninite.com/{}/ninite.exe'.format(url) - try_and_print(message=name, function=download_generic, - other_results=other_results, width=40, - out_dir=dest, out_name=name, source_url=url) + update_all_ninite(other_results=other_results, width=40) # Misc print_info(' Misc')