本文整理匯總了Python中repository.Repository.create方法的典型用法代碼示例。如果您正苦於以下問題:Python Repository.create方法的具體用法?Python Repository.create怎麽用?Python Repository.create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類repository.Repository
的用法示例。
在下文中一共展示了Repository.create方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _run_create
# 需要導入模塊: from repository import Repository [as 別名]
# 或者: from repository.Repository import create [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))