Exemple #1
0
 def search_packages(self, remote, ref, query):
     packages = self._call_remote(remote, "search_packages", ref, query)
     # Filter packages without recipe_hash, those are 1.X packages, the 2.0 are disregarded
     packages = {
         pid: data
         for pid, data in packages.items() if data.get("recipe_hash")
     }
     packages = filter_packages(query, packages)
     return packages
Exemple #2
0
def search_packages(paths, reference, query, v2_compatibility_mode):
    """ Return a dict like this:

            {package_ID: {name: "OpenCV",
                           version: "2.14",
                           settings: {os: Windows}}}
    param conan_ref: ConanFileReference object
    """
    if not os.path.exists(paths.conan(reference)):
        raise NotFoundException("Recipe not found: %s" % str(reference))
    infos = _get_local_infos_min(paths, reference, v2_compatibility_mode)
    return filter_packages(query, infos)
Exemple #3
0
 def search_packages(self, remote, ref, query):
     packages = self._call_remote(remote, "search_packages", ref)
     # Avoid serializing conaninfo in server side
     packages = {
         pid: ConanInfo.loads(data["content"]).serialize_min()
         if "content" in data else data
         for pid, data in packages.items()
     }
     # Filter packages without recipe_hash, those are 1.X packages, the 2.0 are disregarded
     packages = {
         pid: data
         for pid, data in packages.items() if data.get("recipe_hash")
     }
     packages = filter_packages(query, packages)
     return packages
Exemple #4
0
def search_packages(server_store, ref, query, look_in_all_rrevs):
    """
    Used both for v1 and v2. V1 will iterate rrevs.

    Return a dict like this:

            {package_ID: {name: "OpenCV",
                           version: "2.14",
                           settings: {os: Windows}}}
    param ref: ConanFileReference object
    """
    if not look_in_all_rrevs and ref.revision is None:
        latest_rev = server_store.get_last_revision(ref).revision
        ref = ref.copy_with_rev(latest_rev)

    if not os.path.exists(server_store.conan_revisions_root(ref.copy_clear_rev())):
        raise RecipeNotFoundException(ref)
    infos = _get_local_infos_min(server_store, ref, look_in_all_rrevs)
    return filter_packages(query, infos)
Exemple #5
0
    def search_packages(self, reference, query):

        url = "%s/conans/%s/search?" % (self._remote_api_url, "/".join(reference))
        if not query:
            package_infos = self._get_json(url)
            return package_infos

        # Read capabilities
        try:
            _, _, capabilities = self.server_info()
        except NotFoundException:
            capabilities = []

        if COMPLEX_SEARCH_CAPABILITY in capabilities:
            url += urlencode({"q": query})
            package_infos = self._get_json(url)
            return package_infos
        else:
            package_infos = self._get_json(url)
            return filter_packages(query, package_infos)
Exemple #6
0
    def search_packages(self, ref, query):

        if not query:
            url = self.router.search_packages(ref)
            package_infos = self.get_json(url)
            return package_infos

        # Read capabilities
        try:
            _, _, capabilities = self.server_info()
        except NotFoundException:
            capabilities = []

        if COMPLEX_SEARCH_CAPABILITY in capabilities:
            url = self.router.search_packages(ref, query)
            package_infos = self.get_json(url)
            return package_infos
        else:
            url = self.router.search_packages(ref)
            package_infos = self.get_json(url)
            return filter_packages(query, package_infos)
 def search_packages(self, remote, reference, query):
     packages = self._call_remote(remote, "search_packages", reference, query)
     packages = filter_packages(query, packages)
     return packages
Exemple #8
0
 def search_packages(self, reference, query):
     # Do not send the query to the server, as it will fail
     # https://github.com/conan-io/conan/issues/4951
     package_infos = self._get_api().search_packages(reference, query=None)
     return filter_packages(query, package_infos)
Exemple #9
0
 def search_packages(self, reference, query):
     package_infos = self._get_api().search_packages(reference, query)
     if query and COMPLEX_SEARCH_CAPABILITY not in self._cached_capabilities.get(
             self.remote_url, []):
         return filter_packages(query, package_infos)
     return package_infos