aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/portage/exception.py')
-rw-r--r--lib/portage/exception.py38
1 files changed, 33 insertions, 5 deletions
diff --git a/lib/portage/exception.py b/lib/portage/exception.py
index ec8ea1980..7b48aa919 100644
--- a/lib/portage/exception.py
+++ b/lib/portage/exception.py
@@ -1,4 +1,4 @@
-# Copyright 1998-2020 Gentoo Authors
+# Copyright 1998-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
import signal
@@ -30,6 +30,10 @@ class CorruptionError(PortageException):
"""Corruption indication"""
+class CorruptionKeyError(CorruptionError, PortageKeyError):
+ """KeyError raised when corruption is detected (cause should be accesssible as __cause__)"""
+
+
class InvalidDependString(PortageException):
"""An invalid depend string has been encountered"""
@@ -159,7 +163,7 @@ class AmbiguousPackageName(ValueError, PortageException):
def __init__(self, *args, **kwargs):
self.args = args
- super(AmbiguousPackageName, self).__init__(*args, **kwargs)
+ super().__init__(*args, **kwargs)
def __str__(self):
return ValueError.__str__(self)
@@ -181,6 +185,26 @@ class InvalidPackageName(PortagePackageException):
"""Malformed package name"""
+class InvalidBinaryPackageFormat(PortagePackageException):
+ """Invalid Binary Package Format"""
+
+
+class InvalidCompressionMethod(PortagePackageException):
+ """Invalid or unsupported compression method"""
+
+
+class CompressorNotFound(PortagePackageException):
+ """A required compressor binary was not available or executable"""
+
+
+class CompressorOperationFailed(PortagePackageException):
+ """An error occurred during external operation"""
+
+
+class SignedPackage(PortagePackageException):
+ """Unable to update a signed package"""
+
+
class InvalidAtom(PortagePackageException):
"""Malformed atom spec"""
@@ -201,10 +225,10 @@ class UnsupportedAPIException(PortagePackageException):
eapi = str(eapi)
eapi = eapi.lstrip("-")
msg = _(
- "Unable to do any operations on '%(cpv)s', since "
+ f"Unable to do any operations on '{self.cpv}', since "
"its EAPI is higher than this portage version's. Please upgrade"
- " to a portage version that supports EAPI '%(eapi)s'."
- ) % {"cpv": self.cpv, "eapi": eapi}
+ f" to a portage version that supports EAPI '{eapi}'."
+ )
return _unicode_decode(msg, encoding=_encodings["content"], errors="replace")
@@ -216,6 +240,10 @@ class DigestException(SignatureException):
"""A problem exists in the digest"""
+class GPGException(SignatureException):
+ """GPG operation failed"""
+
+
class MissingSignature(SignatureException):
"""Signature was not present in the checked file"""