Skip to content

Commit

Permalink
Add check for the file which indicates a distribution managed environ…
Browse files Browse the repository at this point in the history
…ment.
  • Loading branch information
mrclary committed Oct 4, 2024
1 parent 32456ed commit 7a7323e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 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,11 @@
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 osp.exists(osp.join(get_path('stdlib'), 'EXTERNALLY-MANAGED'))
)


class UpdateManagerWidget(QWidget, SpyderConfigurationAccessor):
"""Check for updates widget."""
Expand Down Expand Up @@ -169,12 +175,9 @@ def start_check_update(self, startup=False):
If startup is True, then checking for updates is delayed 1 min;
actions are disabled during this time as well.
"""
if (
sys.executable.startswith(('/usr/bin/', '/usr/local/bin/'))
or False # TODO: replace with test for distro file
):
if SKIP_CHECK_UPDATE:
logger.debug(
"Will not check for updates: system or managed environment."
"Skip check for updates: system or managed environment."
)
return

Expand Down

0 comments on commit 7a7323e

Please sign in to comment.