def search_components(root_path, path=None): path = path or root_path component_names = set() init_path = path / '__init__.py' if init_path.exists() and is_component(init_path.text()): component_name = root_path.relpathto(path).replace('/', '.') component_names.add(component_name) else: for sub_path in path.dirs(): component_names = component_names.union(search_components(root_path, sub_path)) return component_names
def search_components(root_path, path=None): path = path or root_path component_names = set() init_path = path / '__init__.py' if init_path.exists() and is_component(init_path.text()): component_name = root_path.relpathto(path).replace('/', '.') component_names.add(component_name) else: for sub_path in path.dirs(): component_names |= search_components(root_path, sub_path) return component_names
def find_egginfo(path): path = Path(path) if not path or path == '/': raise ValueError('WARNING: no *.egg-info directory could be found.') return None egginfos = path.dirs('*.egg-info') if len(egginfos) == 0: return find_egginfo(path.dirname()) if len(egginfos) > 1: raise ValueError('WARNING: more than one *.egg-info directory found.') return None return egginfos[0]