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 has_magic_bytes(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
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 has_magic_bytes(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