本文整理汇总了Python中conans.client.remote_registry.RemoteRegistry.remove_ref方法的典型用法代码示例。如果您正苦于以下问题:Python RemoteRegistry.remove_ref方法的具体用法?Python RemoteRegistry.remove_ref怎么用?Python RemoteRegistry.remove_ref使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类conans.client.remote_registry.RemoteRegistry
的用法示例。
在下文中一共展示了RemoteRegistry.remove_ref方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: remote
# 需要导入模块: from conans.client.remote_registry import RemoteRegistry [as 别名]
# 或者: from conans.client.remote_registry.RemoteRegistry import remove_ref [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)
示例2: remote
# 需要导入模块: from conans.client.remote_registry import RemoteRegistry [as 别名]
# 或者: from conans.client.remote_registry.RemoteRegistry import remove_ref [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)
示例3: ConanProxy
# 需要导入模块: from conans.client.remote_registry import RemoteRegistry [as 别名]
# 或者: from conans.client.remote_registry.RemoteRegistry import remove_ref [as 别名]
#.........这里部分代码省略.........
ref_remote = self._registry.get_ref(conan_ref) if conan_ref else None
if self._remote_name:
remote = self._registry.remote(self._remote_name)
else:
if ref_remote:
remote = ref_remote
else:
remote = self._registry.default_remote
return remote, ref_remote
def upload_package(self, package_reference):
remote, current_remote = self._get_remote(package_reference.conan)
if not current_remote:
self._out.warn("Remote for '%s' not defined, uploading to %s"
% (str(package_reference.conan), remote.name))
result = self._remote_manager.upload_package(package_reference, remote)
if not current_remote:
self._registry.set_ref(package_reference.conan, remote)
return result
def get_conan_digest(self, conan_ref):
""" used by update to check the date of packages, require force if older
"""
remote, current_remote = self._get_remote(conan_ref)
result = self._remote_manager.get_conan_digest(conan_ref, remote)
if not current_remote:
self._registry.set_ref(conan_ref, remote)
return result
def get_package_digest(self, package_reference):
""" used by update to check the date of packages, require force if older
"""
remote, ref_remote = self._get_remote(package_reference.conan)
result = self._remote_manager.get_package_digest(package_reference, remote)
if not ref_remote:
self._registry.set_ref(package_reference.conan, remote)
return result
def search(self, pattern=None, ignorecase=True):
remote, _ = self._get_remote()
return self._remote_manager.search(remote, pattern, ignorecase)
def remove(self, conan_ref):
if not self._remote_name:
raise ConanException("Cannot remove, remote not defined")
remote = self._registry.remote(self._remote_name)
result = self._remote_manager.remove(conan_ref, remote)
current_remote = self._registry.get_ref(conan_ref)
if current_remote == remote:
self._registry.remove_ref(conan_ref)
return result
def remove_packages(self, conan_ref, remove_ids):
if not self._remote_name:
raise ConanException("Cannot remove, remote not defined")
remote = self._registry.remote(self._remote_name)
return self._remote_manager.remove_packages(conan_ref, remove_ids, remote)
def download_packages(self, reference, package_ids):
assert(isinstance(package_ids, list))
remote, _ = self._get_remote(reference)
self._remote_manager.get_conanfile(reference, remote)
self._registry.set_ref(reference, remote)
output = ScopedOutput(str(reference), self._out)
for package_id in package_ids:
package_reference = PackageReference(reference, package_id)
self._retrieve_remote_package(package_reference, output, remote)
def _retrieve_remote_package(self, package_reference, output, remote=None):
if remote is None:
remote = self._registry.get_ref(package_reference.conan)
if not remote:
output.warn("Package doesn't have a remote defined. "
"Probably created locally and not uploaded")
return False
package_id = str(package_reference.package_id)
try:
output.info("Looking for package %s in remote '%s' " % (package_id, remote.name))
# Will raise if not found NotFoundException
self._remote_manager.get_package(package_reference, remote)
output.success('Package installed %s' % package_id)
return True
except ConanConnectionError:
raise # This shouldn't be skipped
except ConanException as e:
output.warn('Binary for %s not in remote: %s' % (package_id, str(e)))
return False
def authenticate(self, name, password):
if not name: # List all users, from all remotes
remotes = self._registry.remotes
if not remotes:
self._out.error("No remotes defined")
for remote in remotes:
self._remote_manager.authenticate(remote, None, None)
return
remote, _ = self._get_remote()
return self._remote_manager.authenticate(remote, name, password)
示例4: ConanProxy
# 需要导入模块: from conans.client.remote_registry import RemoteRegistry [as 别名]
# 或者: from conans.client.remote_registry.RemoteRegistry import remove_ref [as 别名]
#.........这里部分代码省略.........
def get_package_digest(self, package_ref):
""" used by update to check the date of packages, require force if older
"""
remote, ref_remote = self._get_remote(package_ref.conan)
result = self._remote_manager.get_package_digest(package_ref, remote)
if not ref_remote:
self._registry.set_ref(package_ref.conan, remote)
return result
def get_package_info(self, package_ref):
""" Gets the package info to check if outdated
"""
remote, ref_remote = self._get_remote(package_ref.conan)
result = self._remote_manager.get_package_info(package_ref, remote)
if not ref_remote:
self._registry.set_ref(package_ref.conan, remote)
return result
def search(self, pattern=None, ignorecase=True):
remote, _ = self._get_remote()
return self._remote_manager.search(remote, pattern, ignorecase)
def search_remotes(self, pattern=None, ignorecase=True):
if self._remote_name:
remote = self._registry.remote(self._remote_name)
search_result = self._remote_manager.search(remote, pattern, ignorecase)
return search_result
for remote in self._registry.remotes:
search_result = self._remote_manager.search(remote, pattern, ignorecase)
if search_result:
return search_result
def search_packages(self, reference, query):
remote, _ = self._get_remote()
return self._remote_manager.search_packages(remote, reference, query)
def remove(self, conan_ref):
if not self._remote_name:
raise ConanException("Cannot remove, remote not defined")
remote = self._registry.remote(self._remote_name)
result = self._remote_manager.remove(conan_ref, remote)
current_remote = self._registry.get_ref(conan_ref)
if current_remote == remote:
self._registry.remove_ref(conan_ref)
return result
def remove_packages(self, conan_ref, remove_ids):
if not self._remote_name:
raise ConanException("Cannot remove, remote not defined")
remote = self._registry.remote(self._remote_name)
return self._remote_manager.remove_packages(conan_ref, remove_ids, remote)
def download_packages(self, reference, package_ids):
assert(isinstance(package_ids, list))
remote, _ = self._get_remote(reference)
export_path = self._client_cache.export(reference)
self._remote_manager.get_recipe(reference, export_path, remote)
conanfile_path = self._client_cache.conanfile(reference)
conanfile = load_conanfile_class(conanfile_path)
short_paths = conanfile.short_paths
self._registry.set_ref(reference, remote)
output = ScopedOutput(str(reference), self._out)
for package_id in package_ids:
package_ref = PackageReference(reference, package_id)
package_folder = self._client_cache.package(package_ref, short_paths=short_paths)
self._retrieve_remote_package(package_ref, package_folder, output, remote)
def _retrieve_remote_package(self, package_ref, package_folder, output, remote=None):
if remote is None:
remote = self._registry.get_ref(package_ref.conan)
if not remote:
output.warn("Package doesn't have a remote defined. "
"Probably created locally and not uploaded")
return False
package_id = str(package_ref.package_id)
try:
output.info("Looking for package %s in remote '%s' " % (package_id, remote.name))
# Will raise if not found NotFoundException
self._remote_manager.get_package(package_ref, package_folder, remote)
output.success('Package installed %s' % package_id)
return True
except ConanConnectionError:
raise # This shouldn't be skipped
except ConanException as e:
output.warn('Binary for %s not in remote: %s' % (package_id, str(e)))
return False
def authenticate(self, name, password):
if not name: # List all users, from all remotes
remotes = self._registry.remotes
if not remotes:
self._out.error("No remotes defined")
for remote in remotes:
self._remote_manager.authenticate(remote, None, None)
return
remote, _ = self._get_remote()
return self._remote_manager.authenticate(remote, name, password)
示例5: remote_remove_ref
# 需要导入模块: from conans.client.remote_registry import RemoteRegistry [as 别名]
# 或者: from conans.client.remote_registry.RemoteRegistry import remove_ref [as 别名]
def remote_remove_ref(self, reference):
registry = RemoteRegistry(self._client_cache.registry, self._user_io.out)
return registry.remove_ref(reference)