INNER CODE UNIT · Python

iter_elf_files

mumu-lhl/Ciyue · tools/bundle_linux_dependencies.py:81

def iter_elf_files(root: Path):
    for path in sorted(root.rglob("*")):
        if path.is_file() and not path.is_symlink() and elf_metadata(path) is not None:
            yield path


def library_index(search_roots: list[Path]) -> dict[str, Path]:
    index: dict[str, Path] = {}
    candidates: list[Path] = []
    for root in search_roots:
        if root.is_dir():
            candidates.extend(path for path in root.rglob("*.so*") if path.is_file())

    for path in sorted(candidates, key=lambda item: (len(item.parts), str(item))):
        index.setdefault(path.name, path.resolve())
    return index

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…