Skip to content

Commit

Permalink
Backport PR #22631 on branch 6.x (PR: Do not check for updates if Spy…
Browse files Browse the repository at this point in the history
…der is in a system or managed environment) (#22657)
  • Loading branch information
meeseeksmachine authored Oct 9, 2024
1 parent ffcb5b4 commit 6688a6d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spyder/plugins/updatemanager/widgets/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import shutil
import subprocess
import sys
from sysconfig import get_path

# Third-party imports
from packaging.version import parse
Expand Down Expand Up @@ -48,6 +49,14 @@
HEADER = _("<h3>Spyder {} is available!</h3><br>")
URL_I = 'https://docs.spyder-ide.org/current/installation.html'

SKIP_CHECK_UPDATE = (
sys.executable.startswith(('/usr/bin/', '/usr/local/bin/'))
or (
not is_anaconda()
and osp.exists(osp.join(get_path('stdlib'), 'EXTERNALLY-MANAGED'))
)
)


class UpdateManagerWidget(QWidget, SpyderConfigurationAccessor):
"""Check for updates widget."""
Expand Down Expand Up @@ -160,12 +169,21 @@ def start_check_update(self, startup=False):
"""
Check for Spyder updates using a QThread.
Do not check for updates if the environment is a system or a managed
environment.
Update actions are disabled in the menubar and statusbar while
checking for updates.
If startup is True, then checking for updates is delayed 1 min;
actions are disabled during this time as well.
"""
if SKIP_CHECK_UPDATE:
logger.debug(
"Skip check for updates: system or managed environment."
)
return

logger.debug(f"Checking for updates. startup = {startup}.")

# Disable check_update_action while the thread is working
Expand Down

0 comments on commit 6688a6d

Please sign in to comment.