(ldso_conf: str, root: str = "/", _first: bool = True)
return paths
Load all the paths from a given ldso config file

    This should handle comments, whitespace, and "include" statements.

    Parameters
    ----------
    ldso_conf
        The file to scan
    root
        The path to prepend to all paths found
    _first
        Recursive use only; is this the first ELF?

    Returns
    -------
    list of paths found
Load all the paths from a given ldso config file
Load all the paths from a given ldso config file
def parse_ld_so_conf(ldso_conf: str, root: str = "/", _first: bool = True) -> List[str]:
    """Load all the paths from a given ldso config file

    This should handle comments, whitespace, and "include" statements.

    Parameters
    ----------
    ldso_conf
        The file to scan
    root
        The path to prepend to all paths found
    _first
        Recursive use only; is this the first ELF?

    Returns
    -------
    list of paths found
    """
    paths = []  # type: List[str]

    dbg_pfx = "" if _first else "  "
    try:
        log.debug("%sparse_ld_so_conf(%s)", dbg_pfx, ldso_conf)
        with open(ldso_conf) as f:
            for line in f.readlines():
                line = line.split("#", 1)[0].strip()
                if not line:
                    continue
                if line.startswith("include "):
                    line = line[8:]
                    if line[0] == "/":
                        line = root + line.lstrip("/")
                    else:
                        line = os.path.dirname(ldso_conf) + "/" + line
                    log.debug("%s  glob: %s", dbg_pfx, line)
                    for path in glob.glob(line):
                        paths += parse_ld_so_conf(path, root=root, _first=False)
                else:
                    paths += [normpath(root + line)]
    except OSError as e:
        if e.errno != errno.ENOENT:
            log.warning(e)

    if _first:
        # XXX: Load paths from ldso itself.
        # Remove duplicate entries to speed things up.
        paths = [p for p in dedupe(paths) if os.path.isdir(p)]

    return paths
def parse_ld_so_conf ( ldso_conf : str , root : str = "/" , _first : bool = True ) -> List [ str ] : paths = [ ] # type: List[str] dbg_pfx = "" if _first else "  " try : log . debug ( "%sparse_ld_so_conf(%s)" , dbg_pfx , ldso_conf ) with open ( ldso_conf ) as f : for line in f . readlines ( ) : line = line . split ( "#" , 1 ) [ 0 ] . strip ( ) if not line : continue if line . startswith ( "include " ) : line = line [ 8 : ] if line [ 0 ] == "/" : line = root + line . lstrip ( "/" ) else : line = os . path . dirname ( ldso_conf ) + "/" + line log . debug ( "%s  glob: %s" , dbg_pfx , line ) for path in glob . glob ( line ) : paths += parse_ld_so_conf ( path , root = root , _first = False ) else : paths += [ normpath ( root + line ) ] except OSError as e : if e . errno != errno . ENOENT : log . warning ( e ) if _first : # XXX: Load paths from ldso itself. # Remove duplicate entries to speed things up. paths = [ p for p in dedupe ( paths ) if os . path . isdir ( p ) ] return paths