class Find(object): def __init__(self, root_path, factory=Path): self._path = Path(root_path) self._factory = factory def __iter__(self): for path, dirs, files in os.walk(self._path.absolute()): for filename in files: yield self._factory(os.path.join(path, filename))
def __init__(self, path): self._shared_library_factory = UniqueFactory(self.SharedLibrary) self._executable_factory = UniqueFactory(self.Executable) path = Path(path) self._init_pre() if path.is_dir(): self._root_path = path self._init_binaries() else: root_path, filename = os.path.split(path.absolute()) self._root_path = Path(root_path) self._init_binary(path) self._init_dependents() self._init_post() self._init_links()