INNER CODE UNIT · Python
ElfMetadata
mumu-lhl/Ciyue · tools/bundle_linux_dependencies.py:53
class ElfMetadata:
needed: tuple[str, ...]
soname: str | None
def elf_metadata(path: Path) -> ElfMetadata | None:
try:
with path.open("rb") as stream:
if stream.read(4) != b"\x7fELF":
return None
except OSError as error:
raise RuntimeError(f"Cannot read {path}: {error}") from error
result = subprocess.run(
["readelf", "--dynamic", str(path)],
check=False,
capture_output=True,
text=True,