本文整理汇总了Python中twitter.pants.base.ParseContext.username方法的典型用法代码示例。如果您正苦于以下问题:Python ParseContext.username方法的具体用法?Python ParseContext.username怎么用?Python ParseContext.username使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twitter.pants.base.ParseContext
的用法示例。
在下文中一共展示了ParseContext.username方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from twitter.pants.base import ParseContext [as 别名]
# 或者: from twitter.pants.base.ParseContext import username [as 别名]
#.........这里部分代码省略.........
head_sha = self.check_output(['git', 'rev-parse', 'HEAD']).strip()
safe_rmtree(self.outdir)
published = []
skip = (self.restart_at is not None)
for target in self.exported_targets():
pushdb, dbfile, repo = get_db(target)
jar, semver, sha, fingerprint = pushdb.as_jar_with_version(target)
published.append(jar)
if skip and (jar.org, jar.name) == self.restart_at:
skip = False
newver = self.overrides.get((jar.org, jar.name)) or semver.bump()
if self.snapshot:
newver = newver.make_snapshot()
if newver <= semver:
raise TaskError('Requested version %s must be greater than the current version %s' % (
newver.version(), semver.version()
))
newfingerprint = self.fingerprint(target, fingerprint_internal)
no_changes = newfingerprint == fingerprint
if no_changes:
changelog = 'No changes for %s - forced push.\n' % jar_coordinate(jar, semver.version())
else:
changelog = self.changelog(target, sha) or 'Direct dependencies changed.\n'
if no_changes and not self.force:
print('No changes for %s' % jar_coordinate(jar, semver.version()))
stage_artifacts(target, jar, (newver if self.force else semver).version(), changelog)
elif skip:
print('Skipping %s to resume at %s' % (
jar_coordinate(jar, (newver if self.force else semver).version()),
coordinate(self.restart_at[0], self.restart_at[1])
))
stage_artifacts(target, jar, semver.version(), changelog)
else:
if not self.dryrun:
# Confirm push looks good
if no_changes:
print(changelog)
else:
print('\nChanges for %s since %s @ %s:\n\n%s' % (
coordinate(jar.org, jar.name), semver.version(), sha, changelog
))
push = raw_input('Publish %s with revision %s ? [y|N] ' % (
coordinate(jar.org, jar.name), newver.version()
))
print('\n')
if push.strip().lower() != 'y':
raise TaskError('User aborted push')
pushdb.set_version(target, newver, head_sha, newfingerprint)
ivyxml = stage_artifacts(target, jar, newver.version(), changelog, confs=repo['confs'])
if self.dryrun:
print('Skipping publish of %s in test mode.' % jar_coordinate(jar, newver.version()))
else:
resolver = repo['resolver']
path = repo.get('path')
# Get authentication for the publish repo if needed
jvmargs = []
auth = repo['auth']
if auth:
buildfile = BuildFile(get_buildroot(), '.', must_exist=False)
def load_credentials():
return list(pants(auth).resolve()).pop()
credentials = ParseContext(buildfile).do_in_context(load_credentials)
jvmargs.append(credentials.username())
jvmargs.append(credentials.password())
# Do the publish
ivysettings = self.generate_ivysettings(published, publish_local=path)
args = [
'-settings', ivysettings,
'-ivy', ivyxml,
'-deliverto', '%s/[organisation]/[module]/ivy-[revision].xml' % self.outdir,
'-publish', resolver,
'-publishpattern',
'%s/[organisation]/[module]/[artifact]-[revision](-[classifier]).[ext]' % self.outdir,
'-revision', newver.version(),
'-m2compatible',
]
if self.snapshot:
args.append('-overwrite')
result = binary_utils.runjava(jvmargs=jvmargs, classpath=self.ivycp, args=args)
if result != 0:
raise TaskError('Failed to push %s - ivy failed with %d' % (
jar_coordinate(jar, newver.version()), result)
)
if self.commit:
pushdb.dump(dbfile)
self.commit_push(jar.org, jar.name, newver.version(), head_sha)