(
    elf: ELFFile, lib: str, ldpaths: List[str], root: str = "/"
)
return (None, None)
Try to locate a ``lib`` that is compatible to ``elf`` in the given
    ``ldpaths``

    Parameters
    ----------
    elf : ELFFile
        The elf which the library should be compatible with (ELF wise)
    lib : str
        The library (basename) to search for
    ldpaths : List[str]
        A list of paths to search
    root : str
       The root path to resolve symlinks

    Returns
    -------
    Tuple of the full path to the desired library and the real path to it
Try to locate a ``lib`` that is compatible to ``elf`` in the given
    ``ldpaths``
Try to locate a lib that is compatible to elf in the given ldpaths
def find_lib(
    elf: ELFFile, lib: str, ldpaths: List[str], root: str = "/"
) -> Tuple[Optional[str], Optional[str]]:
    """Try to locate a ``lib`` that is compatible to ``elf`` in the given
    ``ldpaths``

    Parameters
    ----------
    elf : ELFFile
        The elf which the library should be compatible with (ELF wise)
    lib : str
        The library (basename) to search for
    ldpaths : List[str]
        A list of paths to search
    root : str
       The root path to resolve symlinks

    Returns
    -------
    Tuple of the full path to the desired library and the real path to it
    """

    for ldpath in ldpaths:
        path = os.path.join(ldpath, lib)
        target = readlink(path, root, prefixed=True)

        if os.path.exists(target):
            with open(target, "rb") as f:
                libelf = ELFFile(f)
                if compatible_elfs(elf, libelf):
                    return (target, path)

    return (None, None)
def find_lib ( elf : ELFFile , lib : str , ldpaths : List [ str ] , root : str = "/" ) -> Tuple [ Optional [ str ] , Optional [ str ] ] : for ldpath in ldpaths : path = os . path . join ( ldpath , lib ) target = readlink ( path , root , prefixed = True ) if os . path . exists ( target ) : with open ( target , "rb" ) as f : libelf = ELFFile ( f ) if compatible_elfs ( elf , libelf ) : return ( target , path ) return ( None , None )