misc: small fix or general refactoring i did not bother commenting

This commit is contained in:
Simone Margaritelli 2019-10-20 18:41:57 +02:00
parent 26bb5d6183
commit c947d5c43b
No known key found for this signature in database
GPG Key ID: 82E42E7F3B34C97E

View File

@ -71,7 +71,7 @@ def on_internet_available(agent):
try: try:
display.set('status', 'Checking for updates ...') display.set('status', 'Checking for updates ...')
display.update() display.update(force=True)
to_install = [] to_install = []
to_check = [ to_check = [
@ -87,8 +87,12 @@ def on_internet_available(agent):
logging.warning("new update for %s is available: %s" % (repo, info['url'])) logging.warning("new update for %s is available: %s" % (repo, info['url']))
to_install.append(info) to_install.append(info)
if len(to_install) > 0 and OPTIONS['install']: num_updates = len(to_install)
if num_updates > 0:
if OPTIONS['install']:
logging.info("[update] TODO: install %d updates" % len(to_install)) logging.info("[update] TODO: install %d updates" % len(to_install))
else:
prev_status = '%d new update%c available!' % (num_updates, 's' if num_updates > 1 else '')
logging.info("[update] done") logging.info("[update] done")
@ -98,4 +102,4 @@ def on_internet_available(agent):
logging.error("[update] %s" % e) logging.error("[update] %s" % e)
display.set('status', prev_status if prev_status is not None else '') display.set('status', prev_status if prev_status is not None else '')
display.update() display.update(force=True)