def select(version): date = datetime.datetime.fromtimestamp(version.time).strftime('%c') print("Version:\t%s" % version.version) print("Updated:\t%s" % date) print("Notes:\n\n-----\n%s" % version.notes) print(version.update()) if is_update_installation_pending(): print("Installing...") #note that the GUI will be launched after update but should still do the upgrade headless install_pending_update() # forward updating won't work without reloading sys.exit()
def main(): prs = argparse.ArgumentParser("Binja Version Switcher") prs.add_argument('--version_string', type=str) prs.add_argument('channel_string', metavar='C', type=str) args = prs.parse_args() channel = UpdateChannel[args.channel_string] if args.channel_string is None: channel.update_to_latest() else: set_auto_updates_enabled(False) for v in channel.versions: if args.version_string in v.version: print("Updating...") v.update() if is_update_installation_pending(): install_pending_update() return
def select(version): done = False date = datetime.datetime.fromtimestamp(version.time).strftime('%c') while not done: print("Version:\t%s" % version.version) print("Updated:\t%s" % date) print("Notes:\n\n-----\n%s" % version.notes) print("-----") print("\t1)\tSwitch to version") print("\t2)\tMain Menu") selection = input('Choice: ') if selection.isdigit(): selection = int(selection) else: selection = 0 if (selection == 2): done = True elif (selection == 1): if (version.version == channel.latest_version.version): print("Requesting update to latest version.") else: print("Requesting update to prior version.") if are_auto_updates_enabled(): print("Disabling automatic updates.") set_auto_updates_enabled(False) if (version.version == core_version()): print("Already running %s" % version.version) else: print("version.version %s" % version.version) print("core_version %s" % core_version()) print("Downloading...") print(version.update()) print("Installing...") if is_update_installation_pending: #note that the GUI will be launched after update but should still do the upgrade headless install_pending_update() # forward updating won't work without reloading sys.exit() else: print("Invalid selection")