Debian Codegraph @

src/auditwheel/error.py

raw
1 from __future__ import annotations
2
3
4 class AuditwheelError(Exception):
5 def __init__(self, msg: str) -> None:
6 super().__init__(msg)
7
8 @property
9 def message(self) -> str:
10 assert isinstance(self.args[0], str) # noqa: S101
11 return self.args[0]
12
13
14 class InvalidLibcError(AuditwheelError):
15 pass
16
17
18 class WheelToolsError(AuditwheelError):
19 pass
20
21
22 class NonPlatformWheelError(AuditwheelError):
23 """No ELF binaries in the wheel"""
24
25 def __init__(self, architecture: str | None, libraries: list[str] | None) -> None:
26 if architecture is None or not libraries:
27 msg = (
28 "This does not look like a platform wheel, no ELF executable "
29 "or shared library file (including compiled Python C extension) "
30 "found in the wheel archive"
31 )
32 else:
33 libraries_str = "\n\t".join(libraries)
34 msg = (
35 "Invalid binary wheel: no ELF executable or shared library file "
36 "(including compiled Python C extension) with a "
37 f"{architecture!r} architecure found. The following "
38 f"ELF files were found:\n\t{libraries_str}\n"
39 )
40 super().__init__(msg)