def CheckForUpdates(fileServerPort, debug):
"""
Check for updates.
Channel options are stable, beta & alpha
Patches are only created & applied on the stable channel
"""
assert CLIENT_CONFIG.PUBLIC_KEY is not None
client = Client(CLIENT_CONFIG, refresh=True)
appUpdate = client.update_check(CLIENT_CONFIG.APP_NAME,
wxupdatedemo.__version__,
channel='stable')
if appUpdate:
if hasattr(sys, "frozen"):
downloaded = appUpdate.download()
if downloaded:
status = UpdateStatus.EXTRACTING_UPDATE_AND_RESTARTING
if 'WXUPDATEDEMO_TESTING_FROZEN' in os.environ:
sys.stderr.write("Exiting with status: %s\n"
% UPDATE_STATUS_STR[status])
ShutDownFileServer(fileServerPort)
sys.exit(0)
ShutDownFileServer(fileServerPort)
if debug:
logger.debug('Extracting update and restarting...')
time.sleep(10)
appUpdate.extract_restart()
else:
status = UpdateStatus.UPDATE_DOWNLOAD_FAILED
else:
status = UpdateStatus.UPDATE_AVAILABLE_BUT_APP_NOT_FROZEN
else:
status = UpdateStatus.NO_AVAILABLE_UPDATES
return status
评论列表
文章目录