summaryrefslogtreecommitdiff
path: root/build-aux/measurestack/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'build-aux/measurestack/__init__.py')
-rw-r--r--build-aux/measurestack/__init__.py26
1 files changed, 20 insertions, 6 deletions
diff --git a/build-aux/measurestack/__init__.py b/build-aux/measurestack/__init__.py
index 549e888..e4f1156 100644
--- a/build-aux/measurestack/__init__.py
+++ b/build-aux/measurestack/__init__.py
@@ -147,8 +147,16 @@ class BaseName:
def __str__(self) -> str:
return self._content
+ def __repr__(self) -> str:
+ return f"BaseName({self._content!r})"
+
+ def __format__(self, fmt_spec: str, /) -> str:
+ return repr(self)
+
def __eq__(self, other: typing.Any) -> bool:
- assert isinstance(other, BaseName)
+ assert isinstance(
+ other, BaseName
+ ), f"comparing BaseName with {other.__class__.__name__}"
return self._content == other._content
def __lt__(self, other: "BaseName") -> bool:
@@ -167,6 +175,12 @@ class QName:
def __str__(self) -> str:
return self._content
+ def __repr__(self) -> str:
+ return f"QName({self._content!r})"
+
+ def __format__(self, fmt_spec: str, /) -> str:
+ return repr(self)
+
def __eq__(self, other: typing.Any) -> bool:
assert isinstance(
other, QName
@@ -289,7 +303,7 @@ def analyze(
raise ValueError(f"unknown edge key {k!r}")
if not skip:
if node.funcname in graph:
- raise ValueError(f"duplicate node {str(node.funcname)!r}")
+ raise ValueError(f"duplicate node {node.funcname}")
graph[node.funcname] = node
if ":" in str(node.funcname):
basename = node.funcname.base()
@@ -330,7 +344,7 @@ def analyze(
for node in app.extra_nodes():
if node.funcname in graph:
- raise ValueError(f"duplicate node {str(node.funcname)!r}")
+ raise ValueError(f"duplicate node {node.funcname}")
graph[node.funcname] = node
missing: set[QName] = set()
@@ -341,8 +355,8 @@ def analyze(
def resolve_funcname(funcname: QName) -> QName | None:
# Handle `ld --wrap` functions
- if QName(f"__wrap_{funcname}") in graph:
- return QName(f"__wrap_{funcname}")
+ if QName(f"__wrap_{str(funcname)}") in graph:
+ return QName(f"__wrap_{str(funcname)}")
if (
str(funcname).startswith("__real_")
and QName(str(funcname)[len("__real_") :]) in graph
@@ -1614,7 +1628,7 @@ def main(
if result.groups["Extra"].rows:
print_group("Extra")
for funcname in sorted(result.included_funcs):
- print(f"included: {funcname}")
+ print(f"included: {str(funcname)}")
print("*/")