def _search_recipes(self, pattern=None, ignorecase=True): def get_ref(_pattern): if not isinstance(_pattern, ConanFileReference): try: ref_ = ConanFileReference.loads(_pattern) except (ConanException, TypeError): ref_ = None else: ref_ = _pattern return ref_ # Conan references in main storage if pattern: pattern = str(pattern) b_pattern = translate(pattern) b_pattern = re.compile(b_pattern, re.IGNORECASE) \ if ignorecase else re.compile(b_pattern) subdirs = list_folder_subdirs(basedir=self._server_store.store, level=5) if not pattern: return sorted([ ConanFileReference(*folder.split("/")).copy_clear_rev() for folder in subdirs ]) else: ret = set() for subdir in subdirs: new_ref = ConanFileReference(*subdir.split("/")) if _partial_match(b_pattern, repr(new_ref)): ret.add(new_ref.copy_clear_rev()) return sorted(ret)
def search_recipes(self, pattern=None, ignorecase=True): def get_ref(_pattern): if not isinstance(_pattern, ConanFileReference): try: r = ConanFileReference.loads(_pattern) except (ConanException, TypeError): r = None else: r = _pattern return r def get_folders_levels(_pattern): """If a reference with revisions is detected compare with 5 levels of subdirs""" r = get_ref(_pattern) return 5 if r and r.revision else 4 # Check directly if it is a reference ref = get_ref(pattern) if ref: # Avoid resolve latest revision if a version range is passed or we are performing a # package remove (all revisions) path = self._server_store.conan(ref, resolve_latest=False) if self._server_store.path_exists(path): return [ref] # Conan references in main storage if pattern: pattern = str(pattern) b_pattern = translate(pattern) b_pattern = re.compile(b_pattern, re.IGNORECASE) if ignorecase else re.compile(b_pattern) subdirs = list_folder_subdirs(basedir=self._server_store.store, level=get_folders_levels(pattern)) if not pattern: return sorted([ConanFileReference(*folder.split("/")) for folder in subdirs]) else: ret = [] for subdir in subdirs: conan_ref = ConanFileReference(*subdir.split("/")) if _partial_match(b_pattern, conan_ref): ret.append(conan_ref) return sorted(ret)
def _search_recipes(self, pattern=None, ignorecase=True): subdirs = list_folder_subdirs(basedir=self._server_store.store, level=5) if not pattern: return sorted([ ConanFileReference(*folder.split("/")).copy_clear_rev() for folder in subdirs ]) else: # Conan references in main storage pattern = str(pattern) b_pattern = translate(pattern) b_pattern = re.compile( b_pattern, re.IGNORECASE) if ignorecase else re.compile(b_pattern) ret = set() for subdir in subdirs: new_ref = ConanFileReference(*subdir.split("/")) if _partial_match(b_pattern, repr(new_ref)): ret.add(new_ref.copy_clear_rev()) return sorted(ret)