58
58
LATEST_RELEASE_URL = (
59
59
"https://api.github.com/repos/Numerlor/Auto_Neutron/releases/latest"
60
60
)
61
+
61
62
IS_ONEFILE = Path (getattr (sys , "_MEIPASS" , "" )) != Path (sys .executable ).parent
62
63
63
64
TEMP_NAME = "temp_auto_neutron"
@@ -79,7 +80,7 @@ def check_update(self) -> None:
79
80
80
81
The current executable's file will be renamed to a temporary name, and deleted by this method on the next run.
81
82
"""
82
- if not __debug__ :
83
+ if __debug__ :
83
84
log .info ("Requesting version info." )
84
85
make_network_request (
85
86
LATEST_RELEASE_URL , finished_callback = self ._check_new_version
@@ -216,6 +217,7 @@ def _create_new_and_restart(self, reply: QtNetwork.QNetworkReply) -> None:
216
217
try :
217
218
SignedPEFile (io .BytesIO (download_bytes )).verify ()
218
219
except SignifyError as e :
220
+ log .warning ("Invalid file signature" , exc_info = e )
219
221
self ._show_error_window (
220
222
_ ("Unable to verify downloaded file signature: " + str (e ))
221
223
)
@@ -225,11 +227,13 @@ def _create_new_and_restart(self, reply: QtNetwork.QNetworkReply) -> None:
225
227
try :
226
228
EXECUTABLE_PATH .rename (temp_path )
227
229
except OSError as e :
230
+ log .warning ("Failed to rename executable." , exc_info = e )
228
231
self ._show_error_window (_ ("Unable to rename executable: " ) + str (e ))
229
232
return
230
233
try :
231
234
Path (EXECUTABLE_PATH ).write_bytes (download_bytes )
232
235
except OSError as e :
236
+ log .warning ("Failed to write new executable." , exc_info = e )
233
237
self ._show_error_window (_ ("Unable to create new executable: " ) + str (e ))
234
238
return
235
239
@@ -240,6 +244,7 @@ def _create_new_and_restart(self, reply: QtNetwork.QNetworkReply) -> None:
240
244
try :
241
245
SignedPEFile (io .BytesIO (zip_file .read (file ))).verify ()
242
246
except SignifyError as e :
247
+ log .warning ("Invalid file signature" , exc_info = e )
243
248
self ._show_error_window (
244
249
_ (
245
250
"Unable to verify downloaded file signature for file {}: {}"
@@ -253,6 +258,7 @@ def _create_new_and_restart(self, reply: QtNetwork.QNetworkReply) -> None:
253
258
try :
254
259
temp_path .mkdir (exist_ok = True )
255
260
except OSError as e :
261
+ log .warning ("Failed to create temp directory." , exc_info = e )
256
262
self ._show_error_window (
257
263
_ ("Unable to create temporary directory: " ) + str (e )
258
264
)
@@ -262,6 +268,7 @@ def _create_new_and_restart(self, reply: QtNetwork.QNetworkReply) -> None:
262
268
try :
263
269
shutil .move (file , temp_path )
264
270
except OSError as e :
271
+ log .warning ("Failed to move files to temp directory." , exc_info = e )
265
272
self ._show_error_window (
266
273
_ ("Unable to move files into temporary directory: " ) + str (e )
267
274
)
@@ -270,6 +277,7 @@ def _create_new_and_restart(self, reply: QtNetwork.QNetworkReply) -> None:
270
277
try :
271
278
zip_file .extractall (path = dir_path )
272
279
except OSError as e :
280
+ log .warning ("Failed to extract release." , exc_info = e )
273
281
self ._show_error_window (
274
282
_ ("Unable to extract new release files: " ) + str (e )
275
283
)
0 commit comments