INNER CODE UNIT · Python
library_index
mumu-lhl/Ciyue · tools/bundle_linux_dependencies.py:87
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
def provided_libraries(library_dir: Path) -> dict[str, Path]:
provided: dict[str, Path] = {}
for path in sorted(library_dir.iterdir()):
if not (path.is_file() or path.is_symlink()):
continue
resolved = path.resolve()