Skip to content

Commit 3367949

Browse files
committed
add more logging
1 parent 74507e5 commit 3367949

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

auto_neutron/self_updater.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
LATEST_RELEASE_URL = (
5959
"https://api.github.com/repos/Numerlor/Auto_Neutron/releases/latest"
6060
)
61+
6162
IS_ONEFILE = Path(getattr(sys, "_MEIPASS", "")) != Path(sys.executable).parent
6263

6364
TEMP_NAME = "temp_auto_neutron"
@@ -79,7 +80,7 @@ def check_update(self) -> None:
7980
8081
The current executable's file will be renamed to a temporary name, and deleted by this method on the next run.
8182
"""
82-
if not __debug__:
83+
if __debug__:
8384
log.info("Requesting version info.")
8485
make_network_request(
8586
LATEST_RELEASE_URL, finished_callback=self._check_new_version
@@ -216,6 +217,7 @@ def _create_new_and_restart(self, reply: QtNetwork.QNetworkReply) -> None:
216217
try:
217218
SignedPEFile(io.BytesIO(download_bytes)).verify()
218219
except SignifyError as e:
220+
log.warning("Invalid file signature", exc_info=e)
219221
self._show_error_window(
220222
_("Unable to verify downloaded file signature: " + str(e))
221223
)
@@ -225,11 +227,13 @@ def _create_new_and_restart(self, reply: QtNetwork.QNetworkReply) -> None:
225227
try:
226228
EXECUTABLE_PATH.rename(temp_path)
227229
except OSError as e:
230+
log.warning("Failed to rename executable.", exc_info=e)
228231
self._show_error_window(_("Unable to rename executable: ") + str(e))
229232
return
230233
try:
231234
Path(EXECUTABLE_PATH).write_bytes(download_bytes)
232235
except OSError as e:
236+
log.warning("Failed to write new executable.", exc_info=e)
233237
self._show_error_window(_("Unable to create new executable: ") + str(e))
234238
return
235239

@@ -240,6 +244,7 @@ def _create_new_and_restart(self, reply: QtNetwork.QNetworkReply) -> None:
240244
try:
241245
SignedPEFile(io.BytesIO(zip_file.read(file))).verify()
242246
except SignifyError as e:
247+
log.warning("Invalid file signature", exc_info=e)
243248
self._show_error_window(
244249
_(
245250
"Unable to verify downloaded file signature for file {}: {}"
@@ -253,6 +258,7 @@ def _create_new_and_restart(self, reply: QtNetwork.QNetworkReply) -> None:
253258
try:
254259
temp_path.mkdir(exist_ok=True)
255260
except OSError as e:
261+
log.warning("Failed to create temp directory.", exc_info=e)
256262
self._show_error_window(
257263
_("Unable to create temporary directory: ") + str(e)
258264
)
@@ -262,6 +268,7 @@ def _create_new_and_restart(self, reply: QtNetwork.QNetworkReply) -> None:
262268
try:
263269
shutil.move(file, temp_path)
264270
except OSError as e:
271+
log.warning("Failed to move files to temp directory.", exc_info=e)
265272
self._show_error_window(
266273
_("Unable to move files into temporary directory: ") + str(e)
267274
)
@@ -270,6 +277,7 @@ def _create_new_and_restart(self, reply: QtNetwork.QNetworkReply) -> None:
270277
try:
271278
zip_file.extractall(path=dir_path)
272279
except OSError as e:
280+
log.warning("Failed to extract release.", exc_info=e)
273281
self._show_error_window(
274282
_("Unable to extract new release files: ") + str(e)
275283
)

0 commit comments

Comments
 (0)