upgrade-helper: remove unused UpgradeNotNeededError
PATCH v2 2/2 upgrade-helper: remove unused UpgradeNotNeededError
From: Daniel Turull <[email protected]>
UpgradeNotNeededError is never raised anywhere in the codebase. Remove the class definition and all references to it.
Signed-off-by Daniel Turull <[email protected]>
--- modules/errors.py | 7 ------- modules/statistics.py | 4 +--- upgrade-helper.py | 6 ++---- 3 files changed, 3 insertions(+), 14 deletions(-)
modules/errors.py +0 -7
@@ -89,13 +89,6 @@ class UnsupportedProtocolError(Error): def __str__(self): return "Failed(Unsupported protocol)" -class UpgradeNotNeededError(Error): - def __init__(self): - super(UpgradeNotNeededError, self).__init__("Recipe already up to date") - - def __str__(self): - return "Failed(up to date)" - class EmptyEnvError(Error): def __init__(self, stdout): super(EmptyEnvError, self).__init__("Empty environment returned", stdout)
modules/statistics.py +1 -3
@@ -34,9 +34,7 @@ class Statistics(object): self.total_attempted = 0 def _update(self, pn, new_ver, maintainer, error): - if type(error).__name__ == "UpgradeNotNeededError": - return - elif error is None: + if error is None: status = "Succeeded" else: status = str(error)
upgrade-helper.py +2 -4
@@ -49,7 +49,7 @@ import shutil sys.path.insert(1, os.path.join(os.path.abspath( os.path.dirname(__file__)), 'modules')) -from errors import Error, EmptyEnvError, UpgradeNotNeededError, UnsupportedProtocolError +from errors import Error, EmptyEnvError, UnsupportedProtocolError from utils.git import Git from utils.devtool import Devtool
@@ -527,9 +527,7 @@ class Updater(object): I(" %s: Upgrade SUCCESSFUL! Please test!" % pkggroup_name) except Exception as e: - if isinstance(e, UpgradeNotNeededError): - I(" %s: %s" % (pkggroup_name, e.message)) - elif isinstance(e, UnsupportedProtocolError): + if isinstance(e, UnsupportedProtocolError): I(" %s: %s" % (pkggroup_name, e.message)) else: if not isinstance(e, Error):
Signature · 1 line
2.51.0
Alexander Kanavin
AppliedThanks, applied and pushed.
Alex
Quoted 73 lines · On Wed, 3 Jun 2026 at 19:44, <[email protected]> wrote:
From: Daniel Turull <[email protected]>
UpgradeNotNeededError is never raised anywhere in the codebase. Remove the class definition and all references to it.
Signed-off-by Daniel Turull <[email protected]>--- modules/errors.py | 7 ------- modules/statistics.py | 4 +--- upgrade-helper.py | 6 ++---- 3 files changed, 3 insertions(+), 14 deletions(-)modules/errors.py +0
-7@@ -89,13 +89,6 @@ class UnsupportedProtocolError(Error): def __str__(self): return "Failed(Unsupported protocol)" -class UpgradeNotNeededError(Error): - def __init__(self): - super(UpgradeNotNeededError, self).__init__("Recipe already up to date") - - def __str__(self): - return "Failed(up to date)" - class EmptyEnvError(Error): def __init__(self, stdout): super(EmptyEnvError, self).__init__("Empty environment returned", stdout)modules/statistics.py +1
-3@@ -34,9 +34,7 @@ class Statistics(object): self.total_attempted = 0 def _update(self, pn, new_ver, maintainer, error): - if type(error).__name__ == "UpgradeNotNeededError": - return - elif error is None: + if error is None: status = "Succeeded" else: status = str(error)upgrade-helper.py +2
-5@@ -49,7 +49,7 @@ import shutil sys.path.insert(1, os.path.join(os.path.abspath( os.path.dirname(__file__)), 'modules')) -from errors import Error, EmptyEnvError, UpgradeNotNeededError, UnsupportedProtocolError +from errors import Error, EmptyEnvError, UnsupportedProtocolError from utils.git import Git from utils.devtool import Devtool@@ -527,9 +527,7 @@ class Updater(object): I(" %s: Upgrade SUCCESSFUL! Please test!" % pkggroup_name) except Exception as e: - if isinstance(e, UpgradeNotNeededError): - I(" %s: %s" % (pkggroup_name, e.message)) - elif isinstance(e, UnsupportedProtocolError): + if isinstance(e, UnsupportedProtocolError): I(" %s: %s" % (pkggroup_name, e.message)) else: if not isinstance(e, Error): --2.51.0