Ejemplo n.º 1
0
    def get_bundle_needed_libs(self):
        libs_needed = set()
        bundle_libs = set()
        for root, dirs, files in os.walk(self.app_dir):
            if 'opt/libc' in root:
                continue

            for file in files:
                bundle_libs.add(file)
                abs_path = os.path.join(root, file)
                try:
                    if is_elf(abs_path):
                        patch_elf = PatchElf()
                        patch_elf.log_stdout = False
                        patch_elf.log_stderr = False
                        patch_elf.log_command = False

                        libs_needed.update(patch_elf.get_needed(abs_path))
                except FileNotFoundError:
                    pass
                except PatchElfError:
                    pass

        bundle_needed = libs_needed - bundle_libs
        return bundle_needed
Ejemplo n.º 2
0
    def get_dependants_of(self, lib_name):
        dependants = set()
        for root, dirs, files in os.walk(self.app_dir):
            if 'opt/libc' in root:
                continue

            for file in files:
                abs_path = os.path.join(root, file)
                try:
                    if is_elf(abs_path):
                        patch_elf = PatchElf()
                        patch_elf.log_stdout = False
                        patch_elf.log_stderr = False
                        patch_elf.log_command = False

                        needs = patch_elf.get_needed(abs_path)
                        if lib_name in needs:
                            dependants.add(
                                os.path.relpath(abs_path, self.app_dir))

                except FileNotFoundError:
                    pass
                except PatchElfError:
                    pass

        return dependants
Ejemplo n.º 3
0
 def _set_executables_interpreter(self, interpreter):
     for root, dirs, files in os.walk(self.app_dir):
         for file_name in files:
             path = os.path.join(root, file_name)
             if not os.path.islink(path) and is_elf(path):
                 self._set_interpreter(path, interpreter)