Copy Ninite files to Installers during update

This commit is contained in:
Alan Mason 2017-11-22 20:56:26 -08:00
parent d22339410e
commit 6250ee8865
2 changed files with 27 additions and 9 deletions

View file

@ -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

View file

@ -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')