diff --git a/plinth/modules/upgrades/__init__.py b/plinth/modules/upgrades/__init__.py index 22a046f84..e0e9ba80a 100644 --- a/plinth/modules/upgrades/__init__.py +++ b/plinth/modules/upgrades/__init__.py @@ -10,8 +10,9 @@ from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_noop import plinth +from plinth import action_utils from plinth import app as app_module -from plinth import action_utils, cfg, glib, kvstore, menu, package +from plinth import cfg, glib, kvstore, menu, package from plinth.config import DropinConfigs from plinth.daemon import RelatedDaemon from plinth.diagnostic_check import DiagnosticCheck, Result @@ -294,17 +295,18 @@ def is_backports_current(): def can_activate_backports(): """Return whether backports can be activated.""" - release, _ = get_current_release() - if release == 'unstable' or (release == 'testing' and not cfg.develop): - return False + if cfg.develop: + return True - return True + # Release will be 'n/a' in latest unstable and testing distributions. + release, _ = get_current_release() + return release not in ['unstable', 'testing', 'n/a'] def can_enable_dist_upgrade(): """Return whether dist upgrade can be enabled.""" release, _ = get_current_release() - return release not in ['unstable', 'testing'] + return release not in ['unstable', 'testing', 'n/a'] def can_test_dist_upgrade(): diff --git a/plinth/modules/upgrades/privileged.py b/plinth/modules/upgrades/privileged.py index 37f21a804..781aae07d 100644 --- a/plinth/modules/upgrades/privileged.py +++ b/plinth/modules/upgrades/privileged.py @@ -257,7 +257,7 @@ def _check_and_backports_sources(develop=False): return release, dist = get_current_release() - if release == 'unstable' or (release == 'testing' and not develop): + if release in ['unstable', 'testing', 'n/a'] and not develop: logging.info(f'System release is {release}. Skip enabling backports.') return @@ -326,7 +326,7 @@ def _check_dist_upgrade(test_upgrade=False) -> tuple[bool, str]: from plinth.modules.upgrades import get_current_release release, dist = get_current_release() - if release in ['unstable', 'testing']: + if release in ['unstable', 'testing', 'n/a']: return (False, f'already-{release}') check_dists = ['stable']