本文整理匯總了Python中repository.Repository.add_repo方法的典型用法代碼示例。如果您正苦於以下問題:Python Repository.add_repo方法的具體用法?Python Repository.add_repo怎麽用?Python Repository.add_repo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類repository.Repository
的用法示例。
在下文中一共展示了Repository.add_repo方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setup_repositories
# 需要導入模塊: from repository import Repository [as 別名]
# 或者: from repository.Repository import add_repo [as 別名]
def setup_repositories(self):
"""
set up repositories for software installation and return a
package manager for performing software installation tasks
"""
repository_sections = self.xml_state.get_repository_sections()
package_manager = self.xml_state.get_package_manager()
repo = Repository(
self.root_bind, package_manager
)
for xml_repo in repository_sections:
repo_type = xml_repo.get_type()
repo_source = xml_repo.get_source().get_path()
repo_alias = xml_repo.get_alias()
repo_priority = xml_repo.get_priority()
log.info('Setting up repository %s', repo_source)
log.info('--> Type: %s', repo_type)
if repo_priority:
log.info('--> Priority: %s', repo_priority)
uri = Uri(repo_source, repo_type)
repo_source_translated = uri.translate()
log.info('--> Translated: %s', repo_source_translated)
if not uri.is_remote():
self.root_bind.mount_shared_directory(repo_source_translated)
if not repo_alias:
repo_alias = uri.alias()
log.info('--> Alias: %s', repo_alias)
repo.add_repo(
repo_alias, repo_source_translated, repo_type, repo_priority
)
self.uri_list.append(uri)
repo.cleanup_unused_repos()
return PackageManager(
repo, package_manager
)