本文整理汇总了Python中util.commands.get_output函数的典型用法代码示例。如果您正苦于以下问题:Python get_output函数的具体用法?Python get_output怎么用?Python get_output使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_output函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: bump_and_tag
def bump_and_tag(repo, attempt, config, relbranch, revision, tags,
defaultBranch):
relbranchChangesets = len(tags)
defaultBranchChangesets = 0
if relbranch in get_branches(reponame):
update(reponame, revision=relbranch)
else:
update(reponame, revision=revision)
run_cmd(['hg', 'branch', relbranch], cwd=reponame)
if len(bumpFiles) > 0:
# Bump files on the relbranch, if necessary
bump(reponame, bumpFiles, 'version')
run_cmd(['hg', 'diff'], cwd=repo)
try:
get_output(['hg', 'commit', '-u', config['hgUsername'],
'-m', getBumpCommitMessage(config['productName'], config['version'])],
cwd=reponame)
relbranchChangesets += 1
revision = get_revision(reponame)
except subprocess.CalledProcessError, e:
# We only want to ignore exceptions caused by having nothing to
# commit, which are OK. We still want to raise exceptions caused
# by any other thing.
if e.returncode != 1 or "nothing changed" not in e.output:
raise
开发者ID:EkkiD,项目名称:build-tools,代码行数:27,代码来源:tag-release.py
示例2: testOutputAttachedToError
def testOutputAttachedToError(self):
"""Older versions of CalledProcessError don't attach 'output' to
themselves. This test is to ensure that get_output always does."""
try:
get_output(['bash', '-c', 'echo hello && false'])
except subprocess.CalledProcessError, e:
self.assertEquals(e.output, 'hello\n')
开发者ID:Callek,项目名称:build-tools,代码行数:7,代码来源:test_util_commands.py
示例3: unbundle
def unbundle(bundle, dest):
"""Unbundles the bundle located at `bundle` into `dest`.
`bundle` can be a local file or remote url."""
try:
get_output(['hg', 'unbundle', bundle], cwd=dest, include_stderr=True)
return True
except subprocess.CalledProcessError:
return False
开发者ID:70599,项目名称:Waterfox,代码行数:9,代码来源:hg.py
示例4: tagRepo
def tagRepo(config, repo, reponame, revision, tags, bumpFiles, relbranch,
pushAttempts, defaultBranch='default'):
remote = make_hg_url(HG, repo)
mercurial(remote, reponame)
def bump_and_tag(repo, attempt, config, relbranch, revision, tags,
defaultBranch):
# set relbranchChangesets=1 because tag() generates exactly 1 commit
relbranchChangesets = 1
defaultBranchChangesets = 0
if relbranch in get_branches(reponame):
update(reponame, revision=relbranch)
else:
update(reponame, revision=revision)
run_cmd(['hg', 'branch', relbranch], cwd=reponame)
if len(bumpFiles) > 0:
# Bump files on the relbranch, if necessary
bump(reponame, bumpFiles, 'version')
run_cmd(['hg', 'diff'], cwd=repo)
try:
get_output(['hg', 'commit', '-u', config['hgUsername'],
'-m', getBumpCommitMessage(config['productName'], config['version'])],
cwd=reponame)
relbranchChangesets += 1
except subprocess.CalledProcessError, e:
# We only want to ignore exceptions caused by having nothing to
# commit, which are OK. We still want to raise exceptions caused
# by any other thing.
if e.returncode != 1 or "nothing changed" not in e.output:
raise
# We always want our tags pointing at the tip of the relbranch
# so we need to grab the current revision after we've switched
# branches and bumped versions.
revision = get_revision(reponame)
# Create the desired tags on the relbranch
tag(repo, revision, tags, config['hgUsername'])
# This is the bump of the version on the default branch
# We do it after the other one in order to get the tip of the
# repository back on default, thus avoiding confusion.
if len(bumpFiles) > 0:
update(reponame, revision=defaultBranch)
bump(reponame, bumpFiles, 'nextVersion')
run_cmd(['hg', 'diff'], cwd=repo)
try:
get_output(['hg', 'commit', '-u', config['hgUsername'],
'-m', getBumpCommitMessage(config['productName'], config['version'])],
cwd=reponame)
defaultBranchChangesets += 1
except subprocess.CalledProcessError, e:
if e.returncode != 1 or "nothing changed" not in e.output:
raise
开发者ID:SergiosLen,项目名称:browser-f,代码行数:55,代码来源:tag-release.py
示例5: testTerminateAndGetOutput
def testTerminateAndGetOutput(self):
text_s = "this is just a test"
text_e = "this should go to the stderr"
cmd = ['bash', '-c', 'echo "%s" && echo "%s" 1>&2 && sleep 1 && true' % (text_s, text_e)]
try:
get_output(cmd, timeout=0.5)
except subprocess.CalledProcessError as error:
self.assertTrue(text_s in error.output)
self.assertTrue(text_e not in error.output)
else:
self.fail("get_output did not raise CalledProcessError")
开发者ID:Callek,项目名称:build-tools,代码行数:11,代码来源:test_util_commands.py
示例6: testInsaneOutputStreamTimeout
def testInsaneOutputStreamTimeout(self):
if not has_urandom():
raise SkipTest
text_s = "this is just a test"
# create a huge output, check that text_s is in the raised exception
# output.
# tested with ~400 MB output: decreasing the size of the output to make
# tests faster (terminates happens on time, but proc.communicate() can
# take few seconds)
cmd = ['bash', '-c', 'echo "%s" && dd if=/dev/urandom bs=4096 count=1000 2>&1 && sleep 2 && true' % text_s]
try:
get_output(cmd, include_stderr=False, timeout=1.0)
except subprocess.CalledProcessError as error:
self.assertTrue(text_s in error.output)
else:
self.fail("get_output did not raise CalledProcessError")
开发者ID:Callek,项目名称:build-tools,代码行数:16,代码来源:test_util_commands.py
示例7: get_buildbot_username_param
def get_buildbot_username_param():
cmd = ['buildbot', 'sendchange', '--help']
output = get_output(cmd)
if "-W, --who=" in output:
return "--who"
else:
return "--username"
开发者ID:70599,项目名称:Waterfox,代码行数:7,代码来源:sanity.py
示例8: _run_hg
def _run_hg(cls, command, repo=None, want_output=False):
cmd = [cls.hg, '--config', 'extensions.mq=']
if repo:
cmd.extend(["-R", repo])
if want_output:
return get_output(cmd + command)
else:
run_cmd(cmd + command)
开发者ID:rail,项目名称:build-autoland,代码行数:8,代码来源:mercurial.py
示例9: getRevisions
def getRevisions(dest):
retval = []
for rev in get_output(["hg", "log", "-R", dest, "--template", "{node|short}\n"]).split("\n"):
rev = rev.strip()
if not rev:
continue
retval.append(rev)
return retval
开发者ID:B-Rich,项目名称:build-tools,代码行数:8,代码来源:test_util_hg.py
示例10: downloadNightlyBuild
def downloadNightlyBuild(localeSrcDir, env):
run_cmd(["make", "wget-en-US"], cwd=localeSrcDir, env=env)
run_cmd(["make", "unpack"], cwd=localeSrcDir, env=env)
output = get_output(["make", "ident"], cwd=localeSrcDir, env=env)
info = {}
for line in output.splitlines():
key, value = line.rstrip().split()
info[key] = value
return info
开发者ID:EkkiD,项目名称:build-tools,代码行数:9,代码来源:download.py
示例11: getSVNrev
def getSVNrev(targetSVNDirectory):
"""
Return the svn revision
"""
retval = os.getcwd()
try:
os.chdir(targetSVNDirectory)
return get_output(["svnversion"])
finally:
os.chdir(retval)
开发者ID:pocmo,项目名称:build-tools,代码行数:10,代码来源:svn.py
示例12: getRevInfo
def getRevInfo(dest, rev):
output = get_output(['hg', 'log', '-R', dest, '-r', rev, '--template',
'{author}\n{desc}\n{tags}']).splitlines()
info = {
'user': output[0],
'msg': output[1],
'tags': []
}
if len(output) > 2:
info['tags'] = output[2].split()
return info
开发者ID:bdacode,项目名称:build-tools,代码行数:11,代码来源:test_util_hg.py
示例13: uploadLog
def uploadLog(self, build):
"""Uploads the build log, and returns the URL to it"""
builder = build.builder
info = self.getBuildInfo(build)
branch = info['branch']
product = info['product'].lower()
platform = info['platform']
upload_args = ['-r', '2', '-t', '10', '--master-name',
self.config['statusdb.master_name']]
if "nightly" in builder.name:
upload_args.append("--nightly")
if builder.name.startswith("release-") and \
not info['release_promotion']:
upload_args.append("--release")
upload_args.append(
"%s/%s" % (info.get('version'), info.get('build_number')))
if branch and 'try' in branch:
upload_args.append("--try")
elif branch == 'shadow-central':
upload_args.append("--shadow")
if 'l10n' in builder.name and not info['release_promotion']:
upload_args.append("--l10n")
if product:
upload_args.extend(["--product", product])
if platform:
upload_args.extend(["--platform", platform])
else:
upload_args.extend(["--platform", 'noarch'])
if branch:
upload_args.extend(["--branch", branch])
upload_args.extend(self.getUploadArgs(build, product))
upload_args.extend([builder.basedir, str(build.number)])
my_dir = os.path.abspath(os.path.dirname(__file__))
cmd = [sys.executable, "%s/log_uploader.py" % my_dir] + upload_args
devnull = open(os.devnull)
log.info("Running %s", cmd)
output = get_output(cmd, stdin=devnull)
# Look for URLs
url = re.search("http(s)?://\S+", output)
if url:
return url.group()
return None
开发者ID:Callek,项目名称:build-buildbotcustom,代码行数:54,代码来源:postrun.py
示例14: checkoutSVN
def checkoutSVN(targetSVNDirectory, svnURL):
"""
Checkout the product details SVN
"""
if not os.path.isdir(targetSVNDirectory):
cmd = ["svn", "co", svnURL, targetSVNDirectory]
run_cmd(cmd)
# Sanity check
svnStatus = get_output(["svn", "status", targetSVNDirectory])
if len(svnStatus) != 0:
raise Exception("Uncommited changes: " + svnStatus)
开发者ID:Callek,项目名称:build-tools,代码行数:12,代码来源:svn.py
示例15: hg_ver
def hg_ver():
"""Returns the current version of hg, as a tuple of
(major, minor, build)"""
ver_string = get_output(['hg', '-q', 'version'])
match = re.search("\(version ([0-9.]+)\)", ver_string)
if match:
bits = match.group(1).split(".")
if len(bits) < 3:
bits += (0,)
ver = tuple(int(b) for b in bits)
else:
ver = (0, 0, 0)
log.debug("Running hg version %s", ver)
return ver
开发者ID:70599,项目名称:Waterfox,代码行数:14,代码来源:hg.py
示例16: get_hg_output
def get_hg_output(cmd, **kwargs):
"""
Runs hg with the given arguments and sets HGPLAIN in the environment to
enforce consistent output.
Equivalent to:
env = {}
env['HGPLAIN'] = '1'
return get_output(['hg'] + cmd, env=env, **kwargs)
"""
if 'env' in kwargs:
env = kwargs['env']
del kwargs['env']
else:
env = {}
env['HGPLAIN'] = '1'
return get_output(['hg'] + cmd, env=env, **kwargs)
开发者ID:MaxMillion,项目名称:build-tools,代码行数:16,代码来源:hg.py
示例17: getRevisions
def getRevisions(dest, branches=None):
retval = []
cmd = ['git', 'log', '--pretty=oneline']
if branches:
cmd.extend(branches)
for line in get_output(cmd, cwd=dest).split('\n'):
line = line.strip()
if not line:
continue
rev, ref = line.split(" ", 1)
rev = rev.strip()
if not rev:
continue
if rev not in retval:
retval.append(rev)
retval.reverse()
return retval
开发者ID:B-Rich,项目名称:build-tools,代码行数:17,代码来源:test_util_git.py
示例18: update
def update(dest, branch=None, revision=None):
"""Updates working copy `dest` to `branch` or `revision`. If neither is
set then the working copy will be updated to the latest revision on the
current branch. Local changes will be discarded."""
# If we have a revision, switch to that
if revision is not None:
cmd = ['hg', 'update', '-C', '-r', revision]
run_cmd(cmd, cwd=dest)
else:
# Check & switch branch
local_branch = get_output(['hg', 'branch'], cwd=dest).strip()
cmd = ['hg', 'update', '-C']
# If this is different, checkout the other branch
if branch and branch != local_branch:
cmd.append(branch)
run_cmd(cmd, cwd=dest)
return get_revision(dest)
开发者ID:70599,项目名称:Waterfox,代码行数:20,代码来源:hg.py
示例19: get_hg_output
def get_hg_output(cmd, timeout=1800, **kwargs):
"""
Runs hg with the given arguments and sets HGPLAIN in the environment to
enforce consistent output.
Equivalent to:
env = {}
env['HGPLAIN'] = '1'
return get_output(['hg'] + cmd, env=env, **kwargs)
"""
if 'env' in kwargs:
env = kwargs['env']
del kwargs['env']
else:
env = {}
env['HGPLAIN'] = '1'
try:
return get_output(['hg'] + cmd, timeout=timeout, env=env, **kwargs)
except subprocess.CalledProcessError:
# because we always want hg debug info
log.exception("Hit exception running hg:")
raise
开发者ID:ccooper,项目名称:build-tools,代码行数:21,代码来源:hg.py
示例20: out
def out(src, remote, **kwargs):
"""Check for outgoing changesets present in a repo"""
cmd = ['hg', '-q', 'out', '--template', '{node} {branches}\n']
cmd.extend(common_args(**kwargs))
cmd.append(remote)
if os.path.exists(src):
try:
revs = []
for line in get_output(cmd, cwd=src).rstrip().split("\n"):
try:
rev, branch = line.split()
# Mercurial displays no branch at all if the revision is on
# "default"
except ValueError:
rev = line.rstrip()
branch = "default"
revs.append((rev, branch))
return revs
except subprocess.CalledProcessError, inst:
# In some situations, some versions of Mercurial return "1"
# if no changes are found, so we need to ignore this return code
if inst.returncode == 1:
return []
raise
开发者ID:70599,项目名称:Waterfox,代码行数:24,代码来源:hg.py
注:本文中的util.commands.get_output函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论