コード例 #1
0
 def get(self, remote_name):
     try:
         return self._remote_dict[remote_name]
     except KeyError:
         raise NoRemoteAvailable(
             "No remote '%s' defined in remotes in file %s" %
             (remote_name, self._filename))
コード例 #2
0
def apiv2_search_recipes(query, remote_patterns=None, local_cache=False):
    remote = None
    if remote_patterns is not None and len(remote_patterns) > 0:
        remote = remote_patterns[0].replace("*", "remote")

    if remote and "bad" in remote:
        raise NoRemoteAvailable("Remote '%s' not found in remotes" % remote)

    search_results = {
        "results": [{
            "remote":
            remote,
            "items": [{
                "recipe": {
                    "id": "app/1.0"
                }
            }, {
                "recipe": {
                    "id": "liba/1.0"
                }
            }]
        }]
    }

    return search_results
コード例 #3
0
ファイル: remote_registry.py プロジェクト: ytljc2003/conan
 def __getitem__(self, remote_name):
     try:
         remote = self._remotes[remote_name]
         if remote.disabled:
             raise ConanException("Remote '%s' is disabled" % remote_name)
         else:
             return remote
     except KeyError:
         raise NoRemoteAvailable("No remote '%s' defined in remotes" % remote_name)
コード例 #4
0
 def remote(self, name):
     with fasteners.InterProcessLock(self._filename + ".lock",
                                     logger=logger):
         remotes, _ = self._load()
         try:
             return Remote(name, remotes[name][0], remotes[name][1])
         except KeyError:
             raise NoRemoteAvailable(
                 "No remote '%s' defined in remotes in file %s" %
                 (name, self._filename))
コード例 #5
0
    def set_disabled_state(self, remote_name, state):
        filtered_remotes = []
        for remote in self._remotes.values():
            if fnmatch.fnmatch(remote.name, remote_name):
                filtered_remotes.append(remote)

        if not filtered_remotes and "*" not in remote_name:
            raise NoRemoteAvailable("Remote '%s' not found in remotes" % remote_name)

        for remote in filtered_remotes:
            if remote.disabled == state:
                continue
            self._remotes[remote.name] = Remote(remote.name, remote.url, remote.verify_ssl, state)
コード例 #6
0
 def __delitem__(self, remote_name):
     try:
         del self._remotes[remote_name]
     except KeyError:
         raise NoRemoteAvailable("No remote '%s' defined in remotes" %
                                 (remote_name))
コード例 #7
0
 def default(self):
     try:
         # This is the python way to get the first element of an OrderedDict
         return self._remotes[next(iter(self._remotes))]
     except StopIteration:
         raise NoRemoteAvailable("No default remote defined")
コード例 #8
0
 def __getitem__(self, remote_name):
     try:
         return self._remotes[remote_name]
     except KeyError:
         raise NoRemoteAvailable("No remote '%s' defined in remotes" % remote_name)
コード例 #9
0
 def default(self):
     try:
         return self.list[0]
     except IndexError:
         raise NoRemoteAvailable("No default remote defined in %s" %
                                 self._filename)
コード例 #10
0
 def default_remote(self):
     try:
         return self.remotes[0]
     except:
         raise NoRemoteAvailable("No default remote defined in %s" %
                                 self._filename)