本文整理汇总了Python中repository.Repository.exists方法的典型用法代码示例。如果您正苦于以下问题:Python Repository.exists方法的具体用法?Python Repository.exists怎么用?Python Repository.exists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类repository.Repository
的用法示例。
在下文中一共展示了Repository.exists方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print_repos
# 需要导入模块: from repository import Repository [as 别名]
# 或者: from repository.Repository import exists [as 别名]
def print_repos(prefix):
paths = os.listdir(os.path.join(config.REPO_ROOT, prefix))
print "\n[ Repositories in %s ]" % os.path.join(config.REPO_ROOT, prefix)
paths.sort()
for path in paths:
if Repository.exists(os.path.join(config.REPO_ROOT, prefix, path)):
print path
示例2: _run_commit
# 需要导入模块: from repository import Repository [as 别名]
# 或者: from repository.Repository import exists [as 别名]
def _run_commit(self, options, args):
"""Commit the repository yaml descriptor file."""
prefix, name = __parse_prefix_name(args[0])
try:
repo = __load_repository_from_yaml(prefix, name)
except CommandError:
repo = Repository(prefix, name)
if not Repository.exists(repo.path_to_repo):
raise CommandError('Cannot commit a descriptor for a repo that doesn\'t exist.')
if(options.add):
__add_yaml(repo)
__checkin_yaml(repo, "Committing yaml descriptor for %s." % repo.path)
示例3: _run_create
# 需要导入模块: from repository import Repository [as 别名]
# 或者: from repository.Repository import exists [as 别名]
def _run_create(self, options, args):
"""
Create the repository.
Save the yaml descriptor.
"""
prefix, name = __parse_prefix_name(args[0])
print "Name = %s" % name
if prefix:
print "Prefix = %s" % prefix
print "Fisheye = %s" % options.fisheye
repo = Repository(prefix, name, options.fisheye)
if Repository.exists(repo.path_to_repo):
raise CommandError('A repository named "%s" already exists.' % repo.path)
try:
__check_path_dir(repo)
print 'Creating the repository ...'
repo.create()
print 'Created the repository'
print repo.apache_conf
apache_conf.process_to_file(repo.apache_conf,
{'repopath' : repo.path,
'users' : ', '.join(repo.users()),
'apache_authz_path' : repo.apache_authz})
print "Created apache conf"
__write_repository_yaml(repo)
print "CREATED repository at %s." % repo.path
if options.fisheye:
__write_repository_fisheyeauth(repo)
fisheye_admin = FisheyeAdmin(password=config.FISHEYE_ADMIN_PW)
if fisheye_admin.create_repository(repo, __get_description()):
print "Successfully created a fisheye instance for %s" % repo.name
except Exception, e:
raise CommandError("Failed to create the repository at %s\n" % repo.path_to_repo,
"The original error was: %s: %s" % (type(e), e))