Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport PR #22631 on branch 6.x (PR: Do not check for updates if Spyder is in a system or managed environment) #22657

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading