Skip to content

Commit

Permalink
Set latest_release, installer_path, and compute major_release in star…
Browse files Browse the repository at this point in the history
…t_update. This ensures that they are assigned only if there is an update available and after error is processed. Otherwise, compute major_release can raise error before error_msg is processed.
  • Loading branch information
mrclary committed Nov 15, 2023
1 parent 9a091e7 commit 52818db
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions spyder/plugins/updatemanager/widgets/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ def __init__(self, parent):
self.update_worker = None
self.update_timer = None
self.latest_release = None
self.major_update = None

self.cancelled = False
self.download_thread = None
Expand Down Expand Up @@ -210,11 +209,6 @@ def _process_check_update(self):
# Get results from worker
update_available = self.update_worker.update_available
error_msg = self.update_worker.error
self.latest_release = self.update_worker.latest_release
self.major_update = (
parse(__version__).major < parse(self.latest_release).major
)
self._set_installer_path()

# Always set status, regardless of error, DEV, or startup
self.set_status(PENDING if update_available else NO_STATUS)
Expand Down Expand Up @@ -273,6 +267,12 @@ def start_update(self):
If the installer is already downloaded, proceed to confirm install.
"""
self.latest_release = self.update_worker.latest_release
self._set_installer_path()
major_update = (
parse(__version__).major < parse(self.latest_release).major
)

if self._verify_installer_path():
self.set_status(DOWNLOAD_FINISHED)
self._confirm_install()
Expand All @@ -294,7 +294,7 @@ def start_update(self):
else:
manual_update_messagebox(
self, self.latest_release, self.update_worker.channel)
elif self.major_update:
elif major_update:
msg = _("Would you like to automatically download "
"and install it?")
box = confirm_messagebox(
Expand Down

0 comments on commit 52818db

Please sign in to comment.