2015-02-22 11:38:22 -06:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								# -*- coding: utf-8 -*-  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  application  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  update  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								import  platform  
						 
					
						
							
								
									
										
										
										
											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  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								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 ) :  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 try : 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-17 22:26:44 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  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 ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-02-15 13:06:46 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								 except : 
							 
						 
					
						
							
								
									
										
										
										
											2016-02-19 09:15:46 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  if  endpoint  ==  application . update_url : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   logger . error ( " Update failed! Using mirror URL... " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   return  do_update ( endpoint = application . mirror_update_url ) 
							 
						 
					
						
							
								
									
										
										
										
											2016-02-20 06:34:26 -06:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  else : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								   logger . exception ( " Update failed. " ) 
							 
						 
					
						
							
								
									
										
										
										
											2017-09-17 22:26:44 -05:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								   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  result