Exemplo n.º 1
0
def get_depends(file_path):
    """Parses ldd's output and returns depends of shared lib or executable file"""
    depends = []
    if not os.access(ldd_path, os.X_OK):
        out.error("%s seems problematic. please check it." % ldd_path)
        lpms.terminate()

    if not os.path.exists(file_path):
        raise FileNotFound("%s not found." % file_path)

    if not utils.get_mimetype(file_path) in (
        "application/x-executable",
        "application/x-archive",
        "application/x-sharedlib",
    ):
        out.error("%s is invalid for me." % file_path)
        return

    for line in subprocess.Popen([ldd_path, file_path], stdout=subprocess.PIPE).stdout:
        data = line.strip().split("=>")
        if len(data) == 2:
            parsed = data[1].split(" ")
            if parsed[1] != "":
                if shelltools.is_link(parsed[1]):
                    depends.append(shelltools.real_path(parsed[1]))
                else:
                    depends.append(parsed[1])
    return depends
Exemplo n.º 2
0
def get_depends(file_path):
    '''Parses ldd's output and returns depends of shared lib or executable file'''
    depends = []
    if not os.access(ldd_path, os.X_OK):
        out.error("%s seems problematic. please check it." % ldd_path)
        lpms.terminate()

    if not os.path.exists(file_path):
        raise FileNotFound("%s not found." % file_path)

    if not utils.get_mimetype(file_path) in ('application/x-executable', \
            'application/x-archive', 'application/x-sharedlib'):
        out.error("%s is invalid for me." % file_path)
        return

    for line in subprocess.Popen([ldd_path, file_path], \
            stdout=subprocess.PIPE).stdout:
        data = line.strip().split("=>")
        if len(data) == 2:
            parsed = data[1].split(" ")
            if parsed[1] != "":
                if shelltools.is_link(parsed[1]):
                    depends.append(shelltools.real_path(parsed[1]))
                else:
                    depends.append(parsed[1])
    return depends
Exemplo n.º 3
0
def islink(target):
    return shelltools.is_link(target)