本文整理汇总了Python中gbp.deb.source.DebianSource.is_releasable方法的典型用法代码示例。如果您正苦于以下问题:Python DebianSource.is_releasable方法的具体用法?Python DebianSource.is_releasable怎么用?Python DebianSource.is_releasable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gbp.deb.source.DebianSource
的用法示例。
在下文中一共展示了DebianSource.is_releasable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_is_releasable
# 需要导入模块: from gbp.deb.source import DebianSource [as 别名]
# 或者: from gbp.deb.source.DebianSource import is_releasable [as 别名]
def test_is_releasable(self):
os.makedirs('debian/')
with open('debian/changelog', 'w') as f:
f.write("""git-buildpackage (0.2.3) unstable; urgency=low
* git doesn't like '~' in tag names so replace this with a dot when tagging
-- Guido Guenther <[email protected]> Mon, 2 Oct 2006 18:30:20 +0200
""")
source = DebianSource('.')
self.assertEquals(source.changelog.distribution, "unstable")
self.assertTrue(source.is_releasable())
示例2: main
# 需要导入模块: from gbp.deb.source import DebianSource [as 别名]
# 或者: from gbp.deb.source.DebianSource import is_releasable [as 别名]
def main(argv):
retval = 1
branch = None
dest = None
to_push = {
'refs': [],
'tags': [],
}
(options, args) = parse_args(argv)
if not options:
return ExitCodes.parse_error
if len(args) > 2:
gbp.log.err("Only a single remote repository can be given")
elif len(args) == 2:
dest = args[1]
gbp.log.setup(options.color, options.verbose, options.color_scheme)
try:
repo = DebianGitRepository(os.path.curdir, toplevel=False)
except GitRepositoryError:
gbp.log.err("%s is not inside a git repository" % (os.path.abspath('.')))
return 1
try:
source = DebianSource(repo.path)
branch = repo.branch
if not options.ignore_branch:
if branch != options.debian_branch:
gbp.log.err("You are not on branch '%s' but %s" %
(options.debian_branch,
"on '%s'" % branch if branch else 'in detached HEAD state'))
raise GbpError("Use --ignore-branch to ignore or --debian-branch to set the branch name.")
if not dest:
dest = get_remote(repo, branch)
if options.debian_tag != '':
dtag = repo.version_to_tag(options.debian_tag, source.version)
if repo.has_tag(dtag):
to_push['tags'].append(dtag)
if source.is_releasable() and branch:
ref = 'refs/heads/%s' % branch
to_push['refs'].append((ref, get_push_src(repo, ref, dtag)))
if not source.is_native():
if options.upstream_tag != '':
utag = repo.version_to_tag(options.upstream_tag,
source.upstream_version)
if repo.has_tag(utag):
to_push['tags'].append(utag)
if options.upstream_branch != '':
ref = 'refs/heads/%s' % options.upstream_branch
to_push['refs'].append((ref, get_push_src(repo, ref, utag)))
if options.pristine_tar:
commit = repo.get_pristine_tar_commit(source)
if commit:
ref = 'refs/heads/pristine-tar'
to_push['refs'].append((ref, get_push_src(repo, ref, commit)))
if do_push(repo, [dest], to_push, dry_run=options.dryrun):
retval = 0
else:
gbp.log.err("Failed to push some refs.")
retval = 1
except (GbpError, GitRepositoryError, DebianSourceError) as err:
if str(err):
gbp.log.err(err)
except KeyboardInterrupt:
gbp.log.err("Interrupted. Aborting.")
return retval