2015-02-22 11:38:22 -06:00
# -*- coding: utf-8 -*-
import application
2018-11-22 13:35:19 -06:00
from . import update
2015-05-05 11:18:40 -04:00
import logging
import output
2016-02-19 09:15:46 -06:00
from requests . exceptions import ConnectionError
2018-11-22 13:35:19 -06:00
from . wxUpdater import *
2015-05-05 11:18:40 -04:00
logger = logging . getLogger ( " updater " )
2015-02-22 11:38:22 -06:00
2016-02-19 09:15:46 -06:00
def do_update ( endpoint = application . update_url ) :
2023-06-03 00:39:42 +01:00
if not getattr ( sys , ' frozen ' , False ) :
logger . debug ( " Running from source, aborting update check " )
return False
2021-06-16 16:18:41 -05:00
try :
result = update . perform_update ( endpoint = endpoint , current_version = application . version , app_name = application . name , update_available_callback = available_update_dialog , progress_callback = progress_callback , update_complete_callback = update_finished )
2023-12-31 00:03:30 -06:00
return result
2021-06-16 16:18:41 -05:00
except :
2023-12-31 00:03:30 -06:00
logger . exception ( " Update failed. " )
output . speak ( " An exception occurred while attempting to update " + application . name + " . If this message persists, contact the " + application . name + " developers. More information about the exception has been written to the error log. " , True )
return None