def find_dependents(self): self._linker_path = dict() from ld_vulcanize.tool.otool import otool_load_commands, ActualPath actual_path = ActualPath(executable_path=self.path.dirname()) for load_cmd in otool_load_commands(self.path): if load_cmd['cmd'] == 'LC_LOAD_DYLIB': linker_path = load_cmd['filename'] path = actual_path(linker_path) self._linker_path[path] = linker_path yield path if load_cmd['cmd'] == 'LC_ID_DYLIB': # Is that legal in an executable? print('LC_ID_DYLIB', self, load_cmd)
def find_dependents(self): self._linker_path = dict() from ld_vulcanize.tool.otool import otool_load_commands, ActualPath actual_path = ActualPath(loader_path=self.path.dirname()) for load_cmd in otool_load_commands(self.path): if load_cmd['cmd'] == 'LC_LOAD_DYLIB': linker_path = load_cmd['filename'] path = actual_path(linker_path) self._linker_path[path] = linker_path yield path if load_cmd['cmd'] == 'LC_ID_DYLIB': # install name for a dylib; only relevant when linking but not when executing # print('LC_ID_DYLIB', self, load_cmd) pass
def test_otool_list(self): cmds = list(otool_load_commands(self.BINARY)) dyld = filter(lambda cmd: cmd['cmd'] == 'LC_LOAD_DYLIB', cmds) self.assertTrue(len(dyld) > 0)