readcon-core 0.15.0

An oxidized single and multiple CON file reader and writer with FFI bindings for ergonomic C/C++ usage. Implements CON spec v3.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
"""Verify the ELF identity used by consumers of the shared C ABI."""

import os
from pathlib import Path
import re
import subprocess
import sys


library = Path(sys.argv[1])
report = subprocess.check_output(
    ["readelf", "-d", str(library)], text=True, env={**os.environ, "LC_ALL": "C"}
)
names = re.findall(r"\(SONAME\).*?\[([^\]]+)\]", report)
if names != [library.name]:
    raise SystemExit(f"{library}: expected SONAME {library.name}, found {names}")
print(f"{library.name}: SONAME verified")