當前位置: 首頁>>代碼示例>>Python>>正文


Python RemoteRegistry.add方法代碼示例

本文整理匯總了Python中conans.client.remote_registry.RemoteRegistry.add方法的典型用法代碼示例。如果您正苦於以下問題:Python RemoteRegistry.add方法的具體用法?Python RemoteRegistry.add怎麽用?Python RemoteRegistry.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在conans.client.remote_registry.RemoteRegistry的用法示例。


在下文中一共展示了RemoteRegistry.add方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from conans.client.remote_registry import RemoteRegistry [as 別名]
# 或者: from conans.client.remote_registry.RemoteRegistry import add [as 別名]
    def __init__(self, base_folder=None, current_folder=None,
                 servers=None, users=None, client_version=CLIENT_VERSION,
                 min_server_compatible_version=MIN_SERVER_COMPATIBLE_VERSION):
        """
        storage_folder: Local storage path
        current_folder: Current execution folder
        servers: dict of {remote_name: TestServer}
        logins is a list of (user, password) for auto input in order
        if required==> [("lasote", "mypass"), ("other", "otherpass")]
        """
        self.users = users or {"default":
                               [(TESTING_REMOTE_PRIVATE_USER, TESTING_REMOTE_PRIVATE_PASS)]}
        self.servers = servers or {}

        self.client_version = Version(str(client_version))
        self.min_server_compatible_version = Version(str(min_server_compatible_version))

        self.base_folder = base_folder or temp_folder()
        # Define storage_folder, if not, it will be read from conf file & pointed to real user home
        self.storage_folder = os.path.join(self.base_folder, ".conan", "data")
        self.paths = ConanPaths(self.base_folder, self.storage_folder, TestBufferConanOutput())
        self.default_settings(get_env("CONAN_COMPILER", "gcc"),
                              get_env("CONAN_COMPILER_VERSION", "4.8"))

        self.init_dynamic_vars()

        save(self.paths.registry, "")
        registry = RemoteRegistry(self.paths.registry, TestBufferConanOutput())
        for name, server in self.servers.items():
            registry.add(name, server.fake_url)

        logger.debug("Client storage = %s" % self.storage_folder)
        self.current_folder = current_folder or temp_folder()
開發者ID:NoWiseMan,項目名稱:conan,代碼行數:35,代碼來源:tools.py

示例2: add_remove_update_test

# 需要導入模塊: from conans.client.remote_registry import RemoteRegistry [as 別名]
# 或者: from conans.client.remote_registry.RemoteRegistry import add [as 別名]
    def add_remove_update_test(self):
        f = os.path.join(temp_folder(), "aux_file")
        registry = RemoteRegistry(f, TestBufferConanOutput())
        self.assertEqual(registry.remotes, [("conan.io", "https://server.conan.io"),
                                           ("local", "http://localhost:9300")])
        # Add
        registry.add("new", "new_url")
        self.assertEqual(registry.remotes, [("conan.io", "https://server.conan.io"),
                                            ("local", "http://localhost:9300"),
                                            ("new", "new_url")])
        with self.assertRaises(ConanException):
            registry.add("new", "new_url")
        #Update
        registry.update("new", "other_url")
        self.assertEqual(registry.remotes, [("conan.io", "https://server.conan.io"),
                                            ("local", "http://localhost:9300"),
                                            ("new", "other_url")])
        with self.assertRaises(ConanException):
            registry.update("new2", "new_url")

        # Remove
        registry.remove("local")
        self.assertEqual(registry.remotes, [("conan.io", "https://server.conan.io"),
                                            ("new", "other_url")])
        with self.assertRaises(ConanException):
            registry.remove("new2")
開發者ID:JustgeekDE,項目名稱:conan,代碼行數:28,代碼來源:registry_test.py

示例3: update_servers

# 需要導入模塊: from conans.client.remote_registry import RemoteRegistry [as 別名]
# 或者: from conans.client.remote_registry.RemoteRegistry import add [as 別名]
 def update_servers(self, servers):
     self.servers = servers or {}
     save(self.client_cache.registry, "")
     registry = RemoteRegistry(self.client_cache.registry, TestBufferConanOutput())
     for name, server in self.servers.items():
         if isinstance(server, TestServer):
             registry.add(name, server.fake_url)
         else:
             registry.add(name, server)
開發者ID:19317362,項目名稱:conan,代碼行數:11,代碼來源:tools.py

示例4: remote

# 需要導入模塊: from conans.client.remote_registry import RemoteRegistry [as 別名]
# 或者: from conans.client.remote_registry.RemoteRegistry import add [as 別名]
    def remote(self, *args):
        """ manage remotes
        """
        parser = argparse.ArgumentParser(description=self.remote.__doc__, prog="conan remote")
        subparsers = parser.add_subparsers(dest='subcommand', help='sub-command help')

        # create the parser for the "a" command
        subparsers.add_parser('list', help='list current remotes')
        parser_add = subparsers.add_parser('add', help='add a remote')
        parser_add.add_argument('remote',  help='name of the remote')
        parser_add.add_argument('url',  help='url of the remote')
        parser_add.add_argument('verify_ssl',  help='Verify SSL certificated. Default True',
                                default="True", nargs="?")
        parser_rm = subparsers.add_parser('remove', help='remove a remote')
        parser_rm.add_argument('remote',  help='name of the remote')
        parser_upd = subparsers.add_parser('update', help='update the remote url')
        parser_upd.add_argument('remote',  help='name of the remote')
        parser_upd.add_argument('url',  help='url')
        parser_upd.add_argument('verify_ssl',  help='Verify SSL certificated. Default True',
                                default="True", nargs="?")
        subparsers.add_parser('list_ref',
                              help='list the package recipes and its associated remotes')
        parser_padd = subparsers.add_parser('add_ref',
                                            help="associate a recipe's reference to a remote")
        parser_padd.add_argument('reference',  help='package recipe reference')
        parser_padd.add_argument('remote',  help='name of the remote')
        parser_prm = subparsers.add_parser('remove_ref',
                                           help="dissociate a recipe's reference and its remote")
        parser_prm.add_argument('reference',  help='package recipe reference')
        parser_pupd = subparsers.add_parser('update_ref', help="update the remote associated "
                                            "with a package recipe")
        parser_pupd.add_argument('reference',  help='package recipe reference')
        parser_pupd.add_argument('remote',  help='name of the remote')
        args = parser.parse_args(*args)

        registry = RemoteRegistry(self._client_cache.registry, self._user_io.out)
        if args.subcommand == "list":
            for r in registry.remotes:
                self._user_io.out.info("%s: %s [Verify SSL: %s]" % (r.name, r.url, r.verify_ssl))
        elif args.subcommand == "add":
            verify = get_bool_from_text_value(args.verify_ssl)
            registry.add(args.remote, args.url, args.verify_ssl)
        elif args.subcommand == "remove":
            registry.remove(args.remote)
        elif args.subcommand == "update":
            verify = get_bool_from_text_value(args.verify_ssl)
            registry.update(args.remote, args.url, verify)
        elif args.subcommand == "list_ref":
            for ref, remote in registry.refs.items():
                self._user_io.out.info("%s: %s" % (ref, remote))
        elif args.subcommand == "add_ref":
            registry.add_ref(args.reference, args.remote)
        elif args.subcommand == "remove_ref":
            registry.remove_ref(args.reference)
        elif args.subcommand == "update_ref":
            registry.update_ref(args.reference, args.remote)
開發者ID:conan-io,項目名稱:conan,代碼行數:58,代碼來源:command.py

示例5: remote

# 需要導入模塊: from conans.client.remote_registry import RemoteRegistry [as 別名]
# 或者: from conans.client.remote_registry.RemoteRegistry import add [as 別名]
    def remote(self, *args):
        """ manage remotes
        """
        parser = argparse.ArgumentParser(description=self.remote.__doc__, prog="conan remote")
        subparsers = parser.add_subparsers(dest='subcommand', help='sub-command help')

        # create the parser for the "a" command
        subparsers.add_parser('list', help='list current remotes')
        parser_add = subparsers.add_parser('add', help='add a remote')
        parser_add.add_argument('remote',  help='name of the remote')
        parser_add.add_argument('url',  help='url of the remote')
        parser_rm = subparsers.add_parser('remove', help='remove a remote')
        parser_rm.add_argument('remote',  help='name of the remote')
        parser_upd = subparsers.add_parser('update', help='update the remote url')
        parser_upd.add_argument('remote',  help='name of the remote')
        parser_upd.add_argument('url',  help='url')
        subparsers.add_parser('list_ref',
                              help='list the package recipes and its associated remotes')
        parser_padd = subparsers.add_parser('add_ref',
                                            help="associate a recipe's reference to a remote")
        parser_padd.add_argument('reference',  help='package recipe reference')
        parser_padd.add_argument('remote',  help='name of the remote')
        parser_prm = subparsers.add_parser('remove_ref',
                                           help="dissociate a recipe's reference and its remote")
        parser_prm.add_argument('reference',  help='package recipe reference')
        parser_pupd = subparsers.add_parser('update_ref', help="update the remote associated "
                                            "with a package recipe")
        parser_pupd.add_argument('reference',  help='package recipe reference')
        parser_pupd.add_argument('remote',  help='name of the remote')
        args = parser.parse_args(*args)

        registry = RemoteRegistry(self._conan_paths.registry, self._user_io.out)
        if args.subcommand == "list":
            for r in registry.remotes:
                self._user_io.out.info("%s: %s" % (r.name, r.url))
        elif args.subcommand == "add":
            registry.add(args.remote, args.url)
        elif args.subcommand == "remove":
            registry.remove(args.remote)
        elif args.subcommand == "update":
            registry.update(args.remote, args.url)
        elif args.subcommand == "list_ref":
            for ref, remote in registry.refs.items():
                self._user_io.out.info("%s: %s" % (ref, remote))
        elif args.subcommand == "add_ref":
            registry.add_ref(args.reference, args.remote)
        elif args.subcommand == "remove_ref":
            registry.remove_ref(args.reference)
        elif args.subcommand == "update_ref":
            registry.update_ref(args.reference, args.remote)
開發者ID:JustgeekDE,項目名稱:conan,代碼行數:52,代碼來源:command.py

示例6: insert_test

# 需要導入模塊: from conans.client.remote_registry import RemoteRegistry [as 別名]
# 或者: from conans.client.remote_registry.RemoteRegistry import add [as 別名]
 def insert_test(self):
     f = os.path.join(temp_folder(), "aux_file")
     save(f, "conan.io https://server.conan.io True")
     registry = RemoteRegistry(f, TestBufferConanOutput())
     registry.add("repo1", "url1", True, insert=0)
     self.assertEqual(registry.remotes, [("repo1", "url1", True),
                                         ("conan.io", "https://server.conan.io", True)])
     registry.add("repo2", "url2", True, insert=1)
     self.assertEqual(registry.remotes, [("repo1", "url1", True),
                                         ("repo2", "url2", True),
                                         ("conan.io", "https://server.conan.io", True)])
     registry.add("repo3", "url3", True, insert=5)
     self.assertEqual(registry.remotes, [("repo1", "url1", True),
                                         ("repo2", "url2", True),
                                         ("conan.io", "https://server.conan.io", True),
                                         ("repo3", "url3", True)])
開發者ID:nesono,項目名稱:conan,代碼行數:18,代碼來源:registry_test.py

示例7: remote_add

# 需要導入模塊: from conans.client.remote_registry import RemoteRegistry [as 別名]
# 或者: from conans.client.remote_registry.RemoteRegistry import add [as 別名]
 def remote_add(self, remote, url, verify_ssl=True, insert=None):
     registry = RemoteRegistry(self._client_cache.registry, self._user_io.out)
     return registry.add(remote, url, verify_ssl, insert)
開發者ID:nesono,項目名稱:conan,代碼行數:5,代碼來源:conan_api.py


注:本文中的conans.client.remote_registry.RemoteRegistry.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。