(dm: DirMaker, libdir: str)
Apply ldconfig to update the ld.so.cache.
Apply ldconfig to update the ld.so.cache.
Apply ldconfig to update the ld . so . cache .
def apply_ldconfig(dm: DirMaker, libdir: str) -> None:
    '''
    Apply ldconfig to update the ld.so.cache.
    '''
    if not shutil.which('ldconfig'):
        # If we don't have ldconfig, failure is ignored quietly.
        return

    platlower = platform.system().lower()
    if platlower == 'dragonfly' or 'bsd' in platlower:
        if libdir in dm.all_dirs:
            proc, out, err = Popen_safe(['ldconfig', '-m', libdir])
            if proc.returncode != 0:
                print('Failed to apply ldconfig ...',
                      'Standard output:', out,
                      'Standard error:', err, sep='\n')
        return

    # Try to update ld cache, it could fail if we don't have permission.
    proc, out, err = Popen_safe(['ldconfig', '-v'])
    if proc.returncode == 0:
        return

    # ldconfig failed, print the error only if we actually installed files in
    # any of the directories it lookup for libraries. Otherwise quietly ignore
    # the error.
    for l in out.splitlines():
        # Lines that start with a \t are libraries, not directories.
        if not l or l[0].isspace():
            continue
        # Example: `/usr/lib/i386-linux-gnu/i686: (hwcap: 0x0002000000000000)`
        if l[:l.find(':')] in dm.all_dirs:
            print(f'Failed to apply ldconfig:\n{err}')
            break
def apply_ldconfig ( dm : DirMaker , libdir : str ) -> None : if not shutil . which ( 'ldconfig' ) : # If we don't have ldconfig, failure is ignored quietly. return platlower = platform . system ( ) . lower ( ) if platlower == 'dragonfly' or 'bsd' in platlower : if libdir in dm . all_dirs : proc , out , err = Popen_safe ( [ 'ldconfig' , '-m' , libdir ] ) if proc . returncode != 0 : print ( 'Failed to apply ldconfig ...' , 'Standard output:' , out , 'Standard error:' , err , sep = '\n' ) return # Try to update ld cache, it could fail if we don't have permission. proc , out , err = Popen_safe ( [ 'ldconfig' , '-v' ] ) if proc . returncode == 0 : return # ldconfig failed, print the error only if we actually installed files in # any of the directories it lookup for libraries. Otherwise quietly ignore # the error. for l in out . splitlines ( ) : # Lines that start with a \t are libraries, not directories. if not l or l [ 0 ] . isspace ( ) : continue # Example: `/usr/lib/i386-linux-gnu/i686: (hwcap: 0x0002000000000000)` if l [ : l . find ( ':' ) ] in dm . all_dirs : print ( f'Failed to apply ldconfig:\n{err}' ) break