Issue #2974 - Part 1: Adapt all print statements.

2to3 . --fix print -wn
Essentially, print is a function instead of statement.
Ref:
PEP 3105
https://peps.python.org/pep-3105/
This commit is contained in:
Jeremy Andrews committed 2026-03-04 03:48:01 -06:00
1 parent 5b449bc031
commit e11fc9b4cf
442 files changed
+1875 -1889

No files matched your search

+2 -3
View File
@@ -27,8 +27,7 @@ def main(output, file):
'App:id', 'Gecko:minversion', 'Gecko:maxversion')
missing = [var for var in expected if var not in appdata]
if missing:
print >>sys.stderr, \
"Missing values in %s: %s" % (file, ', '.join(missing))
print("Missing values in %s: %s" % (file, ', '.join(missing)), file=sys.stderr)
sys.exit(1)
if not 'Crash Reporter:serverurl' in appdata:
@@ -57,4 +56,4 @@ if __name__ == '__main__':
if len(sys.argv) != 1:
main(sys.stdout, sys.argv[1])
else:
print >>sys.stderr, "Usage: %s /path/to/application.ini" % sys.argv[0]
print("Usage: %s /path/to/application.ini" % sys.argv[0], file=sys.stderr)
+3 -3
View File
@@ -34,7 +34,7 @@ def symlink(source, link_name):
def check_run(args):
global DEBUG
if DEBUG:
print >> sys.stderr, ' '.join(args)
print(' '.join(args), file=sys.stderr)
r = subprocess.call(args)
assert r == 0
@@ -43,11 +43,11 @@ def run_in(path, args):
d = os.getcwd()
global DEBUG
if DEBUG:
print >> sys.stderr, 'cd "%s"' % path
print('cd "%s"' % path, file=sys.stderr)
os.chdir(path)
check_run(args)
if DEBUG:
print >> sys.stderr, 'cd "%s"' % d
print('cd "%s"' % d, file=sys.stderr)
os.chdir(d)
+2 -2
View File
@@ -81,9 +81,9 @@ def process_files(files, output_filename, digests, strip):
short_file = short_file.lstrip('/')
else:
short_file = file
print >>output, '%s %s %s %s' % (hash, digest,
print('%s %s %s %s' % (hash, digest,
os.path.getsize(file),
short_file)
short_file), file=output)
def setup_logging(level=logging.DEBUG):
'''This function sets up the logging module using a speficiable logging
+11 -11
View File
@@ -148,7 +148,7 @@ def createSSLServerCertificate(build, srcDir):
firstLocation = loc.host
if not firstLocation:
print "Nothing to generate, no automatic secure hosts specified"
print("Nothing to generate, no automatic secure hosts specified")
else:
createRandomFile(rndfile)
@@ -162,7 +162,7 @@ def createSSLServerCertificate(build, srcDir):
return 0
if len(sys.argv) == 1:
print "Specify --gen-server or --gen-ca"
print("Specify --gen-server or --gen-ca")
sys.exit(1)
build = MozbuildObject.from_environment()
@@ -170,23 +170,23 @@ certdir = os.path.join(build.topsrcdir, "build", "pgo", "certs")
if sys.argv[1] == "--gen-server":
certificateStatus = createSSLServerCertificate(build, certdir)
if certificateStatus:
print "TEST-UNEXPECTED-FAIL | SSL Server Certificate generation"
print("TEST-UNEXPECTED-FAIL | SSL Server Certificate generation")
sys.exit(certificateStatus)
if sys.argv[1] == "--gen-ca":
certificateStatus = createCertificateAuthority(build, certdir)
if certificateStatus:
print "TEST-UNEXPECTED-FAIL | Certificate Authority generation"
print("TEST-UNEXPECTED-FAIL | Certificate Authority generation")
else:
print "\n\n"
print "==================================================="
print " IMPORTANT:"
print " To use this new certificate authority in tests"
print " run 'make' at testing/mochitest"
print "==================================================="
print("\n\n")
print("===================================================")
print(" IMPORTANT:")
print(" To use this new certificate authority in tests")
print(" run 'make' at testing/mochitest")
print("===================================================")
sys.exit(certificateStatus)
print "Invalid option specified"
print("Invalid option specified")
sys.exit(1)
+1 -1
View File
@@ -77,7 +77,7 @@ if __name__ == '__main__':
jarlog = os.getenv("JARLOG_FILE")
if jarlog:
env["MOZ_JAR_LOG_FILE"] = os.path.abspath(jarlog)
print "jarlog: %s" % env["MOZ_JAR_LOG_FILE"]
print("jarlog: %s" % env["MOZ_JAR_LOG_FILE"])
cmdargs = ["http://localhost:%d/index.html" % PORT]
runner = FirefoxRunner(profile=profile,
+1 -1
View File
@@ -10,4 +10,4 @@ with open(filename, 'rU') as fh:
source = fh.read()
statements = pymake.parser.parsestring(source, filename)
print statements.to_source()
print(statements.to_source())
+2 -2
View File
@@ -4,9 +4,9 @@ import sys
import pymake.parser
for f in sys.argv[1:]:
print "Parsing %s" % f
print("Parsing %s" % f)
fd = open(f, 'rU')
s = fd.read()
fd.close()
stmts = pymake.parser.parsestring(s, f)
print stmts
print(stmts)
+10 -10
View File
@@ -62,7 +62,7 @@ def parsemakeflags(env):
return opts
def _version(*args):
print """pymake: GNU-compatible make program
print("""pymake: GNU-compatible make program
Copyright (C) 2009 The Mozilla Foundation <http://www.mozilla.org/>
This is free software; see the source for copying conditions.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
@@ -71,7 +71,7 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE."""
DEALINGS IN THE SOFTWARE.""")
_log = logging.getLogger('pymake.execution')
@@ -95,7 +95,7 @@ class _MakeContext(object):
def remakecb(self, remade, error=None):
if error is not None:
print error
print(error)
self.context.defer(self.cb, 2)
return
@@ -125,14 +125,14 @@ class _MakeContext(object):
self.makefile.finishparsing()
self.makefile.remakemakefiles(self.remakecb)
except util.MakeError, e:
print e
print(e)
self.context.defer(self.cb, 2)
return
if len(self.targets) == 0:
if self.makefile.defaulttarget is None:
print "No target specified and no default target found."
print("No target specified and no default target found.")
self.context.defer(self.cb, 2)
return
@@ -154,7 +154,7 @@ class _MakeContext(object):
if not len(self.realtargets):
if self.options.printdir:
print "make.py[%i]: Leaving directory '%s'" % (self.makelevel, self.workdir)
print("make.py[%i]: Leaving directory '%s'" % (self.makelevel, self.workdir))
sys.stdout.flush()
self.context.defer(self.cb, 0)
@@ -255,14 +255,14 @@ def main(args, env, cwd, cb):
context = process.getcontext(options.jobcount)
if options.printdir:
print "make.py[%i]: Entering directory '%s'" % (makelevel, workdir)
print("make.py[%i]: Entering directory '%s'" % (makelevel, workdir))
sys.stdout.flush()
if len(options.makefiles) == 0:
if os.path.exists(util.normaljoin(workdir, 'Makefile')):
options.makefiles.append('Makefile')
else:
print "No makefile found"
print("No makefile found")
cb(2)
return
@@ -270,9 +270,9 @@ def main(args, env, cwd, cb):
_MakeContext(makeflags, makelevel, workdir, context, env, targets, options, ostmts, overrides, cb)
except (util.MakeError), e:
print e
print(e)
if options.printdir:
print "make.py[%i]: Leaving directory '%s'" % (makelevel, workdir)
print("make.py[%i]: Leaving directory '%s'" % (makelevel, workdir))
sys.stdout.flush()
cb(2)
return
+5 -5
View File
@@ -864,7 +864,7 @@ class RemakeRuleContext(object):
assert error in (True, False)
if error:
print "<%s>: Found error" % self.target.target
print("<%s>: Found error" % self.target.target)
self.error = True
if didanything:
self.didanything = True
@@ -950,7 +950,7 @@ class RemakeRuleContext(object):
try:
self.commands = [c for c in self.rule.getcommands(self.target, self.makefile)]
except util.MakeError, e:
print e
print(e)
sys.stdout.flush()
cb(error=True)
return
@@ -1285,7 +1285,7 @@ class Target(object):
self.resolvedeps(makefile, targetstack, [], False)
except util.MakeError, e:
if printerror:
print e
print(e)
self.error = True
self.notifydone(makefile)
return
@@ -1397,7 +1397,7 @@ class _CommandWrapper(object):
def _cb(self, res):
if res != 0 and not self.ignoreErrors:
print "%s: command '%s' failed, return code %i" % (self.loc, self.cline, res)
print("%s: command '%s' failed, return code %i" % (self.loc, self.cline, res))
self.usercb(error=True)
else:
self.usercb(error=False)
@@ -1591,7 +1591,7 @@ class _RemakeContext(object):
assert error in (True, False)
if error and self.required:
print "Error remaking makefiles (ignored)"
print("Error remaking makefiles (ignored)")
if len(self.toremake):
target, self.required = self.toremake.pop(0)
+2 -2
View File
@@ -786,7 +786,7 @@ class ShellFunction(Function):
p = subprocess.Popen(cline, executable=executable, env=makefile.env, shell=False,
stdout=subprocess.PIPE, cwd=makefile.workdir)
except OSError, e:
print >>sys.stderr, "Error executing command %s" % cline[0], e
print("Error executing command %s" % cline[0], e, file=sys.stderr)
return
finally:
os.environ['PATH'] = oldpath
@@ -830,7 +830,7 @@ class InfoFunction(Function):
def resolve(self, makefile, variables, fd, setting):
v = self._arguments[0].resolvestr(makefile, variables, setting)
print v
print(v)
functionmap = {
'subst': SubstFunction,
+13 -13
View File
@@ -207,7 +207,7 @@ class Rule(Statement):
context.currule = rule
def dump(self, fd, indent):
print >>fd, "%sRule %s: %s" % (indent, self.targetexp, self.depexp)
print("%sRule %s: %s" % (indent, self.targetexp, self.depexp), file=fd)
def to_source(self):
sep = ':'
@@ -285,7 +285,7 @@ class StaticPatternRule(Statement):
context.currule = rule
def dump(self, fd, indent):
print >>fd, "%sStaticPatternRule %s: %s: %s" % (indent, self.targetexp, self.patternexp, self.depexp)
print("%sStaticPatternRule %s: %s: %s" % (indent, self.targetexp, self.patternexp, self.depexp), file=fd)
def to_source(self):
sep = ':'
@@ -339,7 +339,7 @@ class Command(Statement):
context.currule.addcommand(self.exp)
def dump(self, fd, indent):
print >>fd, "%sCommand %s" % (indent, self.exp,)
print("%sCommand %s" % (indent, self.exp,), file=fd)
def to_source(self):
# Commands have some interesting quirks when it comes to source
@@ -438,7 +438,7 @@ class SetVariable(Statement):
v.set(vname, flavor, self.source, value)
def dump(self, fd, indent):
print >>fd, "%sSetVariable<%s> %s %s\n%s %r" % (indent, self.valueloc, self.vnameexp, self.token, indent, self.value)
print("%sSetVariable<%s> %s %s\n%s %r" % (indent, self.valueloc, self.vnameexp, self.token, indent, self.value), file=fd)
def __eq__(self, other):
if not isinstance(other, SetVariable):
@@ -651,14 +651,14 @@ class ConditionBlock(Statement):
i += 1
def dump(self, fd, indent):
print >>fd, "%sConditionBlock" % (indent,)
print("%sConditionBlock" % (indent,), file=fd)
indent2 = indent + ' '
for c, statements in self._groups:
print >>fd, "%s Condition %s" % (indent, c)
print("%s Condition %s" % (indent, c), file=fd)
statements.dump(fd, indent2)
print >>fd, "%s ~Condition" % (indent,)
print >>fd, "%s~ConditionBlock" % (indent,)
print("%s ~Condition" % (indent,), file=fd)
print("%s~ConditionBlock" % (indent,), file=fd)
def to_source(self):
lines = []
@@ -793,7 +793,7 @@ class Include(Statement):
makefile.include(f, self.required, loc=self.exp.loc, weak=self.weak)
def dump(self, fd, indent):
print >>fd, "%sInclude %s" % (indent, self.exp)
print("%sInclude %s" % (indent, self.exp), file=fd)
def to_source(self):
prefix = ''
@@ -840,7 +840,7 @@ class VPathDirective(Statement):
makefile.addvpath(pattern, dirs)
def dump(self, fd, indent):
print >>fd, "%sVPath %s" % (indent, self.exp)
print("%sVPath %s" % (indent, self.exp), file=fd)
def to_source(self):
return 'vpath %s' % self.exp.to_source()
@@ -885,7 +885,7 @@ class ExportDirective(Statement):
makefile.exportedvars[v] = True
def dump(self, fd, indent):
print >>fd, "%sExport (single=%s) %s" % (indent, self.single, self.exp)
print("%sExport (single=%s) %s" % (indent, self.single, self.exp), file=fd)
def to_source(self):
return ('export %s' % self.exp.to_source()).rstrip()
@@ -915,7 +915,7 @@ class UnexportDirective(Statement):
makefile.exportedvars[v] = False
def dump(self, fd, indent):
print >>fd, "%sUnexport %s" % (indent, self.exp)
print("%sUnexport %s" % (indent, self.exp), file=fd)
def to_source(self):
return 'unexport %s' % self.exp.to_source()
@@ -947,7 +947,7 @@ class EmptyDirective(Statement):
raise data.DataError("Line expands to non-empty value", self.exp.loc)
def dump(self, fd, indent):
print >>fd, "%sEmptyDirective: %s" % (indent, self.exp)
print("%sEmptyDirective: %s" % (indent, self.exp), file=fd)
def to_source(self):
return self.exp.to_source()
+9 -9
View File
@@ -332,7 +332,7 @@ class PopenJob(Job):
p = subprocess.Popen(self.argv, executable=self.executable, shell=self.shell, env=self.env, cwd=self.cwd)
return p.wait()
except OSError, e:
print >>sys.stderr, e
print(e, file=sys.stderr)
return -127
finally:
os.environ['PATH'] = oldpath
@@ -383,30 +383,30 @@ class PythonJob(Job):
try:
__import__(self.module)
except Exception as e:
print >>sys.stderr, 'Error importing %s: %s' % (
self.module, e)
print('Error importing %s: %s' % (
self.module, e), file=sys.stderr)
return -127
m = sys.modules[self.module]
if self.method not in m.__dict__:
print >>sys.stderr, "No method named '%s' in module %s" % (self.method, self.module)
print("No method named '%s' in module %s" % (self.method, self.module), file=sys.stderr)
return -127
rv = m.__dict__[self.method](self.argv)
if rv != 0 and rv is not None:
print >>sys.stderr, (
print((
"Native command '%s %s' returned value '%s'" %
(self.module, self.method, rv))
(self.module, self.method, rv)), file=sys.stderr)
return (rv if isinstance(rv, int) else 1)
except PythonException, e:
print >>sys.stderr, e
print(e, file=sys.stderr)
return e.exitcode
except:
e = sys.exc_info()[1]
if isinstance(e, SystemExit) and (e.code == 0 or e.code is None):
pass # sys.exit(0) is not a failure
else:
print >>sys.stderr, e
print(e, file=sys.stderr)
traceback.print_exc()
return -127
finally:
@@ -461,7 +461,7 @@ class ParallelContext(object):
def _docall_generic(self, pool, job, cb, echo, justprint):
if echo is not None:
print echo
print(echo)
processcb = job.get_callback(ParallelContext._condition)
if justprint:
processcb(0)
+1 -1
View File
@@ -134,7 +134,7 @@ class IterTest(TestBase):
self.assertEqual(actual, expected)
if ifunc == pymake.parser.itermakefilechars:
print "testing %r" % expected
print("testing %r" % expected)
self.assertEqual(pymake.parser.flattenmakesyntax(d, 0), expected)
multitest(IterTest)
+11 -11
View File
@@ -78,15 +78,15 @@ def runTest(makefile, make, logfile, options):
logfd.close()
if stdout.find('TEST-FAIL') != -1:
print stdout
print(stdout)
return False, "FAIL (TEST-FAIL printed)"
if options['grepfor'] and stdout.find(options['grepfor']) == -1:
print stdout
print(stdout)
return False, "FAIL (%s not in output)" % options['grepfor']
if options['returncode'] == 0 and stdout.find('TEST-PASS') == -1:
print stdout
print(stdout)
return False, 'FAIL (No TEST-PASS printed)'
if options['returncode'] != 0:
@@ -94,7 +94,7 @@ def runTest(makefile, make, logfile, options):
return True, 'PASS'
print "%-30s%-28s%-28s" % ("Test:", "gmake:", "pymake:")
print("%-30s%-28s%-28s" % ("Test:", "gmake:", "pymake:"))
gmakefails = 0
pymakefails = 0
@@ -153,7 +153,7 @@ for makefile in makefiles:
elif key == 'skip':
d['skip'] = True
else:
print >>sys.stderr, "%s: Unexpected #T key: %s" % (makefile, key)
print("%s: Unexpected #T key: %s" % (makefile, key), file=sys.stderr)
sys.exit(1)
mdata.close()
@@ -190,12 +190,12 @@ for makefile in makefiles:
else:
pymakemsg = "OK (known fail)"
print "%-30.30s%-28.28s%-28.28s" % (os.path.basename(makefile),
gmakemsg, pymakemsg)
print("%-30.30s%-28.28s%-28.28s" % (os.path.basename(makefile),
gmakemsg, pymakemsg))
print
print "Summary:"
print "%-30s%-28s%-28s" % ("", "gmake:", "pymake:")
print()
print("Summary:")
print("%-30s%-28s%-28s" % ("", "gmake:", "pymake:"))
if gmakefails == 0:
gmakemsg = 'PASS'
@@ -207,7 +207,7 @@ if pymakefails == 0:
else:
pymakemsg = 'FAIL (%i failures)' % pymakefails
print "%-30.30s%-28.28s%-28.28s" % ('', gmakemsg, pymakemsg)
print("%-30.30s%-28.28s%-28.28s" % ('', gmakemsg, pymakemsg))
shutil.rmtree(opts.tempdir)
+9 -9
View File
@@ -131,11 +131,11 @@ def maybe_clear_cache(data):
is_set = cache.get('ac_cv_env_%s_set' % precious) == 'set'
value = cache.get('ac_cv_env_%s_value' % precious) if is_set else None
if value != env.get(precious):
print 'Removing %s because of %s value change from:' \
% (data['cache-file'], precious)
print ' %s' % (value if value is not None else 'undefined')
print 'to:'
print ' %s' % env.get(precious, 'undefined')
print('Removing %s because of %s value change from:' \
% (data['cache-file'], precious))
print(' %s' % (value if value is not None else 'undefined'))
print('to:')
print(' %s' % env.get(precious, 'undefined'))
os.remove(data['cache-file'])
return True
return False
@@ -333,8 +333,8 @@ def run(objdir):
# We're going to run it ourselves.
command += ['--no-create']
print prefix_lines('configuring', relobjdir)
print prefix_lines('running %s' % ' '.join(command[:-1]), relobjdir)
print(prefix_lines('configuring', relobjdir))
print(prefix_lines('running %s' % ' '.join(command[:-1]), relobjdir))
sys.stdout.flush()
try:
output += subprocess.check_output(command,
@@ -368,7 +368,7 @@ def run(objdir):
if not skip_config_status:
if skip_configure:
print prefix_lines('running config.status', relobjdir)
print(prefix_lines('running config.status', relobjdir))
sys.stdout.flush()
try:
output += subprocess.check_output([data['shell'], '-c',
@@ -410,7 +410,7 @@ def subconfigure(args):
pool = Pool(len(subconfigures))
for relobjdir, returncode, output in \
pool.imap_unordered(run, subconfigures):
print prefix_lines(output, relobjdir)
print(prefix_lines(output, relobjdir))
sys.stdout.flush()
ret = max(returncode, ret)
if ret:
+16 -16
View File
@@ -104,10 +104,10 @@ def DoSSHCommand(command, user, host, port=None, ssh_key=None):
try:
output = f(cmdline, stderr=STDOUT).strip()
except CalledProcessError as e:
print "failed ssh command output:"
print '=' * 20
print e.output
print '=' * 20
print("failed ssh command output:")
print('=' * 20)
print(e.output)
print('=' * 20)
raise
return output
@@ -118,7 +118,7 @@ def DoSCPFile(file, remote_path, user, host, port=None, ssh_key=None,
"""Upload file to user@host:remote_path using scp. Optionally use
port and ssh_key, if provided."""
if log:
print 'Uploading %s' % file
print('Uploading %s' % file)
cmdline = ["scp"]
AppendOptionalArgsToSSHCommandline(cmdline, port, ssh_key)
cmdline.extend([WindowsPathToMsysPath(file),
@@ -221,8 +221,8 @@ def UploadFiles(user, host, path, files, verbose=False, port=None, ssh_key=None,
if not host or not user:
return {}
if (not path and not upload_to_temp_dir) or (path and upload_to_temp_dir):
print "One (and only one of UPLOAD_PATH or UPLOAD_TO_TEMP must be " + \
"defined."
print("One (and only one of UPLOAD_PATH or UPLOAD_TO_TEMP must be " + \
"defined.")
sys.exit(1)
if upload_to_temp_dir:
@@ -269,18 +269,18 @@ def UploadFiles(user, host, path, files, verbose=False, port=None, ssh_key=None,
if post_upload_command is not None:
if verbose:
print "Running post-upload command: " + post_upload_command
print("Running post-upload command: " + post_upload_command)
file_list = '"' + '" "'.join(remote_files) + '"'
output = DoSSHCommand('%s "%s" %s' % (post_upload_command, path, file_list), user, host, port=port, ssh_key=ssh_key)
# We print since mozharness may parse URLs from the output stream.
print output
print(output)
properties = GetUrlProperties(output, package)
finally:
if upload_to_temp_dir:
DoSSHCommand("rm -rf %s" % path, user, host, port=port,
ssh_key=ssh_key)
if verbose:
print "Upload complete"
print("Upload complete")
return properties
def CopyFilesLocally(path, files, verbose=False, base_path=None, package=None):
@@ -299,7 +299,7 @@ def CopyFilesLocally(path, files, verbose=False, base_path=None, package=None):
if not os.path.exists(target_path):
os.makedirs(target_path)
if verbose:
print "Copying " + file + " to " + target_path
print("Copying " + file + " to " + target_path)
shutil.copy(file, target_path)
def WriteProperties(files, properties_file, url_properties, package):
@@ -341,20 +341,20 @@ if __name__ == '__main__':
help="Name of the main package.")
(options, args) = parser.parse_args()
if len(args) < 1:
print "You must specify at least one file to upload"
print("You must specify at least one file to upload")
sys.exit(1)
if not options.properties_file:
print "You must specify a --properties-file"
print("You must specify a --properties-file")
sys.exit(1)
if host == "localhost":
if upload_to_temp_dir:
print "Cannot use UPLOAD_TO_TEMP with UPLOAD_HOST=localhost"
print("Cannot use UPLOAD_TO_TEMP with UPLOAD_HOST=localhost")
sys.exit(1)
if post_upload_command:
# POST_UPLOAD_COMMAND is difficult to extract from the mozharness
# scripts, so just ignore it until it's no longer used anywhere
print "Ignoring POST_UPLOAD_COMMAND with UPLOAD_HOST=localhost"
print("Ignoring POST_UPLOAD_COMMAND with UPLOAD_HOST=localhost")
try:
if host == "localhost":
@@ -371,5 +371,5 @@ if __name__ == '__main__':
WriteProperties(args, options.properties_file, url_properties, options.package)
except IOError, (strerror):
print strerror
print(strerror)
sys.exit(1)
+3 -3
View File
@@ -36,7 +36,7 @@ def count_ctors(filename):
# Even if we have .ctors, we shouldn't have any constructors in .ctors.
# Complain if .ctors does not look how we expect it to.
if have_ctors and n_ctors_ctors != 0:
print >>sys.stderr, "Unexpected .ctors contents for", filename
print("Unexpected .ctors contents for", filename, file=sys.stderr)
sys.exit(1)
return n_init_array_ctors
if have_ctors:
@@ -44,7 +44,7 @@ def count_ctors(filename):
# We didn't find anything; somebody switched initialization mechanisms on
# us, or the binary is completely busted. Complain either way.
print >>sys.stderr, "Couldn't find .init_array or .ctors in", filename
print("Couldn't find .init_array or .ctors in", filename, file=sys.stderr)
sys.exit(1)
if __name__ == '__main__':
@@ -60,5 +60,5 @@ if __name__ == '__main__':
}]}
]
}
print "PERFHERDER_DATA: %s" % json.dumps(perfherder_data)
print("PERFHERDER_DATA: %s" % json.dumps(perfherder_data))
+10 -10
View File
@@ -23,8 +23,8 @@ BINSCOPE_OUTPUT_LOGFILE = r".\binscope_xml_output.log"
# usage
if len(sys.argv) < 3:
print """usage : autobinscope.by path_to_binary path_to_symbols [log_file_path]"
log_file_path is optional, log will be written to .\binscope_xml_output.log by default"""
print("""usage : autobinscope.by path_to_binary path_to_symbols [log_file_path]"
log_file_path is optional, log will be written to .\binscope_xml_output.log by default""")
sys.exit(0)
binary_path = sys.argv[1]
@@ -40,7 +40,7 @@ else:
try:
binscope_path = os.environ['BINSCOPE']
except KeyError:
print "BINSCOPE environment variable is not set, can't check DEP/ASLR etc. status."
print("BINSCOPE environment variable is not set, can't check DEP/ASLR etc. status.")
sys.exit(0)
try:
@@ -53,11 +53,11 @@ try:
except WindowsError, (errno, strerror):
if errno != 2 and errno != 3:
print "Unexpected error ! \nError " + str(errno) + " : " + strerror + "\nExiting !\n"
print("Unexpected error ! \nError " + str(errno) + " : " + strerror + "\nExiting !\n")
sys.exit(0)
else:
print "Could not locate binscope at location : %s\n" % binscope_path
print "Binscope wasn't installed or the BINSCOPE env variable wasn't set correctly, skipping this check and exiting..."
print("Could not locate binscope at location : %s\n" % binscope_path)
print("Binscope wasn't installed or the BINSCOPE env variable wasn't set correctly, skipping this check and exiting...")
sys.exit(0)
proc.wait()
@@ -66,10 +66,10 @@ output = proc.communicate()[0]
# is this a PASS or a FAIL ?
if proc.returncode != 0:
print "Error count: %d" % proc.returncode
print "TEST-UNEXPECTED-FAIL | autobinscope.py | %s is missing a needed Windows protection, such as /GS or ASLR" % binary_path
print("Error count: %d" % proc.returncode)
print("TEST-UNEXPECTED-FAIL | autobinscope.py | %s is missing a needed Windows protection, such as /GS or ASLR" % binary_path)
logfile = open(log_file_path, "r")
for line in logfile:
print(line),
print((line), end=' ')
else:
print "TEST-PASS | autobinscope.py | %s succeeded" % binary_path
print("TEST-PASS | autobinscope.py | %s succeeded" % binary_path)
+1 -1
View File
@@ -39,6 +39,6 @@ def MergePGOFiles(basename, pgddir, pgcdir):
if __name__ == '__main__':
if len(sys.argv) != 3:
print >>sys.stderr, "Usage: pgomerge.py <binary basename> <dist/bin>"
print("Usage: pgomerge.py <binary basename> <dist/bin>", file=sys.stderr)
sys.exit(1)
MergePGOFiles(sys.argv[1], os.getcwd(), sys.argv[2])
+3 -3
View File
@@ -40,9 +40,9 @@ if __name__ == '__main__':
0, # no inherit
int(pid))
if handle:
print "Process %s:" % pid
print("Process %s:" % pid)
vsize, peak_vsize = get_vmsize(handle)
print "peak vsize: %d" % peak_vsize
print("peak vsize: %d" % peak_vsize)
ctypes.windll.kernel32.CloseHandle(handle)
else:
print "Couldn't open process %s" % pid
print("Couldn't open process %s" % pid)
+5 -5
View File
@@ -226,7 +226,7 @@ def write_zip(zip_path, prefix=None):
if __name__ == '__main__':
if len(sys.argv) != 3:
print('usage: %s create-zip <path-prefix>' % sys.argv[0])
print(('usage: %s create-zip <path-prefix>' % sys.argv[0]))
sys.exit(1)
assert sys.argv[1] == 'create-zip'
@@ -244,7 +244,7 @@ if __name__ == '__main__':
sha256.update(data)
sha512.update(data)
print('Hashes of %s (size=%d)' % (destzip, len(data)))
print('SHA-1: %s' % sha1.hexdigest())
print('SHA-256: %s' % sha256.hexdigest())
print('SHA-512: %s' % sha512.hexdigest())
print(('Hashes of %s (size=%d)' % (destzip, len(data))))
print(('SHA-1: %s' % sha1.hexdigest()))
print(('SHA-256: %s' % sha256.hexdigest()))
print(('SHA-512: %s' % sha512.hexdigest()))
+12 -12
View File
@@ -22,7 +22,7 @@ if topsrcdir == '':
topsrcdir = '.'
def check_call_noisy(cmd, *args, **kwargs):
print "Executing command:", cmd
print("Executing command:", cmd)
check_call(cmd, *args, **kwargs)
def do_hg_pull(dir, repository, hg):
@@ -67,22 +67,22 @@ def do_cvs_export(modules, tag, cvsroot, cvs):
cvs_module = module_tuple[1]
fullpath = os.path.join(topsrcdir, module)
if os.path.exists(fullpath):
print "Removing '%s'" % fullpath
print("Removing '%s'" % fullpath)
shutil.rmtree(fullpath)
(parent, leaf) = os.path.split(module)
print "CVS export begin: " + datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S UTC")
print("CVS export begin: " + datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S UTC"))
check_call_noisy([cvs, '-d', cvsroot,
'export', '-r', tag, '-d', leaf, cvs_module],
cwd=os.path.join(topsrcdir, parent))
print "CVS export end: " + datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S UTC")
print("CVS export end: " + datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S UTC"))
def toggle_trailing_blank_line(depname):
"""If the trailing line is empty, then we'll delete it.
Otherwise we'll add a blank line."""
lines = open(depname, "r").readlines()
if not lines:
print >>sys.stderr, "unexpected short file"
print("unexpected short file", file=sys.stderr)
return
if not lines[-1].strip():
@@ -95,7 +95,7 @@ def toggle_trailing_blank_line(depname):
def get_trailing_blank_line_state(depname):
lines = open(depname, "r").readlines()
if not lines:
print >>sys.stderr, "unexpected short file"
print("unexpected short file", file=sys.stderr)
return "no blank line"
if not lines[-1].strip():
@@ -104,18 +104,18 @@ def get_trailing_blank_line_state(depname):
return "no blank line"
def update_nspr_or_nss(tag, depfile, destination, hgpath):
print "reverting to HG version of %s to get its blank line state" % depfile
print("reverting to HG version of %s to get its blank line state" % depfile)
check_call_noisy([options.hg, 'revert', depfile])
old_state = get_trailing_blank_line_state(depfile)
print "old state of %s is: %s" % (depfile, old_state)
print("old state of %s is: %s" % (depfile, old_state))
do_hg_replace(destination, hgpath, tag, HG_EXCLUSIONS, options.hg)
new_state = get_trailing_blank_line_state(depfile)
print "new state of %s is: %s" % (depfile, new_state)
print("new state of %s is: %s" % (depfile, new_state))
if old_state == new_state:
print "toggling blank line in: ", depfile
print("toggling blank line in: ", depfile)
toggle_trailing_blank_line(depfile)
tag_file = destination + "/TAG-INFO"
print >>file(tag_file, "w"), tag
print(tag, file=file(tag_file, "w"))
o = OptionParser(usage="client.py [options] update_nspr tagname | update_nss tagname | update_libffi tagname")
o.add_option("--skip-mozilla", dest="skip_mozilla",
@@ -139,7 +139,7 @@ except IndexError:
sys.exit(2)
if action in ('checkout', 'co'):
print >>sys.stderr, "Warning: client.py checkout is obsolete."
print("Warning: client.py checkout is obsolete.", file=sys.stderr)
pass
elif action in ('update_nspr'):
tag, = args[1:]
+1 -1
View File
@@ -140,4 +140,4 @@ class ExpandArgs(list):
return [relativize(arg)]
if __name__ == '__main__':
print " ".join(ExpandArgs(sys.argv[1:]))
print(" ".join(ExpandArgs(sys.argv[1:])))
+4 -4
View File
@@ -305,11 +305,11 @@ class SectionFinder(object):
return syms
def print_command(out, args):
print >>out, "Executing: " + " ".join(args)
print("Executing: " + " ".join(args), file=out)
for tmp in [f for f in args.tmp if os.path.isfile(f)]:
print >>out, tmp + ":"
print(tmp + ":", file=out)
with open(tmp) as file:
print >>out, "".join([" " + l for l in file.readlines()])
print("".join([" " + l for l in file.readlines()]), file=out)
out.flush()
def main(args, proc_callback=None):
@@ -340,7 +340,7 @@ def main(args, proc_callback=None):
if proc_callback:
proc_callback(proc)
except Exception, e:
print >>sys.stderr, 'error: Launching', args, ':', e
print('error: Launching', args, ':', e, file=sys.stderr)
raise e
(stdout, stderr) = proc.communicate()
if proc.returncode and not options.verbose:
+1 -1
View File
@@ -38,4 +38,4 @@ if __name__ == '__main__':
ensureParentDir(options.output)
with open(options.output, 'w') as outfile:
print >>outfile, generate(args)
print(generate(args), file=outfile)
+2 -2
View File
@@ -18,7 +18,7 @@ def periodically_print_status(proc):
time.sleep(0.5)
idleTime += 0.5
if idleTime > 20 * 60:
print "Still linking, 20 minutes passed..."
print("Still linking, 20 minutes passed...")
sys.stdout.flush()
idleTime = 0
@@ -42,6 +42,6 @@ def wrap_linker(args):
if __name__ == "__main__":
if len(sys.argv) < 2:
print >>sys.stderr, "Usage: link.py <commandline>"
print("Usage: link.py <commandline>", file=sys.stderr)
sys.exit(1)
sys.exit(wrap_linker(sys.argv[1:]))
+4 -4
View File
@@ -10,7 +10,7 @@ from StringIO import StringIO
try:
(file, section, key) = sys.argv[1:]
except ValueError:
print "Usage: printconfigsetting.py <file> <section> <setting>"
print("Usage: printconfigsetting.py <file> <section> <setting>")
sys.exit(1)
with open(file) as fh:
@@ -21,11 +21,11 @@ c = configobj.ConfigObj(StringIO(content))
try:
s = c[section]
except KeyError:
print >>sys.stderr, "Section [%s] not found." % section
print("Section [%s] not found." % section, file=sys.stderr)
sys.exit(1)
try:
print s[key]
print(s[key])
except KeyError:
print >>sys.stderr, "Key %s not found." % key
print("Key %s not found." % key, file=sys.stderr)
sys.exit(1)
+1 -1
View File
@@ -9,7 +9,7 @@ Run a python script, adding extra directories to the python path.
def main(args):
def usage():
print >>sys.stderr, "pythonpath.py -I directory script.py [args...]"
print("pythonpath.py -I directory script.py [args...]", file=sys.stderr)
sys.exit(150)
paths = []
+5 -5
View File
@@ -18,7 +18,7 @@ def rebuild_check(args):
deps = args[1:]
t = mtime(target)
if t < 0:
print target
print(target)
return
newer = []
@@ -31,13 +31,13 @@ def rebuild_check(args):
newer.append(dep)
if newer and removed:
print 'Rebuilding %s because %s changed and %s was removed' % (target, ', '.join(newer), ', '.join(removed))
print('Rebuilding %s because %s changed and %s was removed' % (target, ', '.join(newer), ', '.join(removed)))
elif newer:
print 'Rebuilding %s because %s changed' % (target, ', '.join(newer))
print('Rebuilding %s because %s changed' % (target, ', '.join(newer)))
elif removed:
print 'Rebuilding %s because %s was removed' % (target, ', '.join(removed))
print('Rebuilding %s because %s was removed' % (target, ', '.join(removed)))
else:
print 'Rebuilding %s for an unknown reason' % target
print('Rebuilding %s for an unknown reason' % target)
if __name__ == '__main__':
import sys
@@ -97,4 +97,4 @@ class MachCommands(MachCommandBase):
with open(destination_path, 'wb') as destination:
destination.write(preamble + contents)
print('The database was successfully generated at ' + destination_path)
print(('The database was successfully generated at ' + destination_path))
+9 -9
View File
@@ -152,12 +152,12 @@ receipt_with_wrong_typ = {
"reissue": "http://mochi.test:8888/reissue/5169314356"
}
print("let valid_receipt1 = \"" + jwt.encode(receipt1, "") + "\";\n")
print("let valid_receipt2 = \"" + jwt.encode(receipt2, "") + "\";\n")
print("let receipt_without_typ = \"" + jwt.encode(receipt_without_typ, "") + "\";\n")
print("let receipt_without_product = \"" + jwt.encode(receipt_without_product, "") + "\";\n")
print("let receipt_without_user = \"" + jwt.encode(receipt_without_user, "") + "\";\n")
print("let receipt_without_iss = \"" + jwt.encode(receipt_without_iss, "") + "\";\n")
print("let receipt_without_nbf = \"" + jwt.encode(receipt_without_nbf, "") + "\";\n")
print("let receipt_without_iat = \"" + jwt.encode(receipt_without_iat, "") + "\";\n")
print("let receipt_with_wrong_typ = \"" + jwt.encode(receipt_with_wrong_typ, "") + "\";\n")
print(("let valid_receipt1 = \"" + jwt.encode(receipt1, "") + "\";\n"))
print(("let valid_receipt2 = \"" + jwt.encode(receipt2, "") + "\";\n"))
print(("let receipt_without_typ = \"" + jwt.encode(receipt_without_typ, "") + "\";\n"))
print(("let receipt_without_product = \"" + jwt.encode(receipt_without_product, "") + "\";\n"))
print(("let receipt_without_user = \"" + jwt.encode(receipt_without_user, "") + "\";\n"))
print(("let receipt_without_iss = \"" + jwt.encode(receipt_without_iss, "") + "\";\n"))
print(("let receipt_without_nbf = \"" + jwt.encode(receipt_without_nbf, "") + "\";\n"))
print(("let receipt_without_iat = \"" + jwt.encode(receipt_without_iat, "") + "\";\n"))
print(("let receipt_with_wrong_typ = \"" + jwt.encode(receipt_with_wrong_typ, "") + "\";\n"))
+2 -2
View File
@@ -270,7 +270,7 @@ class WebIDLCodegenManager(LoggingMixin):
# Generate bindings from .webidl files.
for filename in sorted(changed_inputs):
basename = mozpath.basename(filename)
print basename
print(basename)
sys.stdout.flush()
result.inputs.add(filename)
written, deps = self._generate_build_files_for_webidl(filename)
@@ -314,7 +314,7 @@ class WebIDLCodegenManager(LoggingMixin):
example_paths = self._example_paths(interface)
for path in example_paths:
print "Generating %s" % path
print("Generating %s" % path)
return self._maybe_write_codegen(root, *example_paths)
+4 -4
View File
@@ -2174,7 +2174,7 @@ class IDLUnresolvedType(IDLType):
assert obj
if obj.isType():
print obj
print(obj)
assert not obj.isType()
if obj.isTypedef():
assert self.name.name == obj.identifier.name
@@ -3504,7 +3504,7 @@ class IDLInterfaceMember(IDLObjectWithIdentifier, IDLExposureMixins):
def finish(self, scope):
# We better be exposed _somewhere_.
if (len(self._exposureGlobalNames) == 0):
print self.identifier.name
print(self.identifier.name)
assert len(self._exposureGlobalNames) != 0
IDLExposureMixins.finish(self, scope)
@@ -6961,14 +6961,14 @@ def main():
f = open(fullPath, 'rb')
lines = f.readlines()
f.close()
print fullPath
print(fullPath)
parser.parse(''.join(lines), fullPath)
parser.finish()
except WebIDLError, e:
if options.verbose_errors:
traceback.print_exc()
else:
print e
print(e)
if __name__ == '__main__':
main()
+11 -11
View File
@@ -22,22 +22,22 @@ class TestHarness(object):
def finish(self):
if self.verbose or self.printed_intro:
print "Finished test %s" % self.test
print("Finished test %s" % self.test)
def maybe_print_intro(self):
if not self.printed_intro:
print "Starting test %s" % self.test
print("Starting test %s" % self.test)
self.printed_intro = True
def test_pass(self, msg):
self.passed += 1
if self.verbose:
print "TEST-PASS | %s" % msg
print("TEST-PASS | %s" % msg)
def test_fail(self, msg):
self.maybe_print_intro()
self.failures.append(msg)
print "TEST-UNEXPECTED-FAIL | %s" % msg
print("TEST-UNEXPECTED-FAIL | %s" % msg)
def ok(self, condition, msg):
if condition:
@@ -79,15 +79,15 @@ def run_tests(tests, verbose):
failed_tests.append((test, harness.failures))
if verbose or failed_tests:
print
print 'Result summary:'
print 'Successful: %d' % all_passed
print 'Unexpected: %d' % \
sum(len(failures) for _, failures in failed_tests)
print()
print('Result summary:')
print('Successful: %d' % all_passed)
print('Unexpected: %d' % \
sum(len(failures) for _, failures in failed_tests))
for test, failures in failed_tests:
print '%s:' % test
print('%s:' % test)
for failure in failures:
print 'TEST-UNEXPECTED-FAIL | %s' % failure
print('TEST-UNEXPECTED-FAIL | %s' % failure)
def get_parser():
usage = """%(prog)s [OPTIONS] [TESTS]
@@ -68,7 +68,7 @@ for line in fin:
skipLine = False
for css in cssPattern.findall(line):
skipLine = True
print('Ignoring stylesheet: ' + css)
print(('Ignoring stylesheet: ' + css))
for inc in includePattern.findall(line):
skipLine = True
@@ -82,10 +82,10 @@ for line in fin:
incData = ReadLocalFile(inc + '.js')
if not incData:
print('Warning: Unknown JS file ignored: ' + inc + '.js')
print(('Warning: Unknown JS file ignored: ' + inc + '.js'))
continue
print('Injecting include: ' + inc + '.js')
print(('Injecting include: ' + inc + '.js'))
fout.write('\n<script>\n// Imported from: ' + inc + '.js\n');
fout.write(incData);
fout.write('\n</script>\n');
@@ -181,7 +181,7 @@ class VideoPuppeteer(object):
played_ranges.end(0) > 0.0
)
except Exception as e:
print ('Got exception {}'.format(e))
print(('Got exception {}'.format(e)))
return False
def playback_done(self):
+3 -3
View File
@@ -25,7 +25,7 @@ def compute_sum(data):
if i[0] not in last_values.keys():
last_values[i[0]] = 0
last_values[i[0]] = float(i[3])
print last_values
print(last_values)
out[0].append(i[2])
out[1].append(sum(last_values.values()))
return out
@@ -59,12 +59,12 @@ if len(sys.argv) == 3:
name = sys.argv[1]
channels = int(sys.argv[2])
else:
print sys.argv[0] + "latency_log"
print(sys.argv[0] + "latency_log")
try:
f = open(sys.argv[1])
except:
print "cannot open " + name
print("cannot open " + name)
raw_lines = f.readlines()
lines = clean_data(raw_lines)
+13 -13
View File
@@ -44,7 +44,7 @@ def convertOffset(i):
else:
return 1024
print """//
print("""//
// Copyright (c) 2012 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -54,27 +54,27 @@ print """//
namespace gl
{
"""
""")
print "const static unsigned g_mantissa[2048] = {"
print("const static unsigned g_mantissa[2048] = {")
for i in range(0, 2048):
print " %#010x," % convertMantissa(i)
print "};\n"
print(" %#010x," % convertMantissa(i))
print("};\n")
print "const static unsigned g_exponent[64] = {"
print("const static unsigned g_exponent[64] = {")
for i in range(0, 64):
print " %#010x," % convertExponent(i)
print "};\n"
print(" %#010x," % convertExponent(i))
print("};\n")
print "const static unsigned g_offset[64] = {"
print("const static unsigned g_offset[64] = {")
for i in range(0, 64):
print " %#010x," % convertOffset(i)
print "};\n"
print(" %#010x," % convertOffset(i))
print("};\n")
print """float float16ToFloat32(unsigned short h)
print("""float float16ToFloat32(unsigned short h)
{
unsigned i32 = g_mantissa[g_offset[h >> 10] + (h & 0x3ff)] + g_exponent[h >> 10];
return bitCast<float>(i32);
}
}
"""
""")
@@ -182,7 +182,7 @@ def do_format(format_data):
elif support == '11_0check':
fl_11_0_check.update(d3d_flag)
else:
print("Data specification error: " + support)
print(("Data specification error: " + support))
sys.exit(1)
for feature_level in ['10_0', '10_1', '11_0']:
+1 -1
View File
@@ -137,7 +137,7 @@ class GLDatabase:
xmlPath = getXMLDir() + path
if not os.path.isfile(xmlPath):
print 'missing file "' + xmlPath + '"'
print('missing file "' + xmlPath + '"')
return False
tree = xml.etree.ElementTree.parse(xmlPath)
+2 -2
View File
@@ -24,13 +24,13 @@ stat = 0
for x in HBHEADERS:
with open (x, 'r', encoding='utf-8') as f: content = f.read ()
if ('HB_BEGIN_DECLS' not in content) or ('HB_END_DECLS' not in content):
print ('Ouch, file %s does not have HB_BEGIN_DECLS / HB_END_DECLS, but it should' % x)
print(('Ouch, file %s does not have HB_BEGIN_DECLS / HB_END_DECLS, but it should' % x))
stat = 1
for x in HBSOURCES:
with open (x, 'r', encoding='utf-8') as f: content = f.read ()
if ('HB_BEGIN_DECLS' in content) or ('HB_END_DECLS' in content):
print ('Ouch, file %s has HB_BEGIN_DECLS / HB_END_DECLS, but it shouldn\'t' % x)
print(('Ouch, file %s has HB_BEGIN_DECLS / HB_END_DECLS, but it shouldn\'t' % x))
stat = 1
sys.exit (stat)
+1 -1
View File
@@ -14,7 +14,7 @@ for x in HBHEADERS:
with open (x, 'r', encoding='utf-8') as f: content = f.read ()
for s in re.findall (r'\n.+\nhb_.+\n', content):
if not s.startswith ('\nHB_EXTERN '):
print ('failure on:', s)
print(('failure on:', s))
stat = 1
sys.exit (stat)
+1 -1
View File
@@ -28,7 +28,7 @@ for x in HBHEADERS + HBSOURCES:
tag = x.upper ().replace ('.', '_').replace ('-', '_').replace(os.path.sep, '_').replace('/', '_')
with open (x, 'r', encoding='utf-8') as f: content = f.read ()
if len (re.findall (tag + r'\b', content)) != 3:
print ('Ouch, header file %s does not have correct preprocessor guards. Expected: %s' % (x, tag))
print(('Ouch, header file %s does not have correct preprocessor guards. Expected: %s' % (x, tag)))
stat = 1
sys.exit (stat)
+3 -3
View File
@@ -29,7 +29,7 @@ for x in HBHEADERS:
with open (x, 'r', encoding='utf-8') as f: content = f.read ()
first = re.findall (r'#.*include.*', content)[0]
if first not in ['#include "hb.h"', '#include "hb-common.h"']:
print ('failure on %s' % x)
print(('failure on %s' % x))
stat = 1
print ('Checking that source files #include a private header first (or none)')
@@ -38,14 +38,14 @@ for x in HBSOURCES:
includes = re.findall (r'#.*include.*', content)
if includes:
if not len (re.findall (r'".*\.hh"', includes[0])):
print ('failure on %s' % x)
print(('failure on %s' % x))
stat = 1
print ('Checking that there is no #include <hb-*.h>')
for x in HBHEADERS + HBSOURCES:
with open (x, 'r', encoding='utf-8') as f: content = f.read ()
if re.findall ('#.*include.*<.*hb', content):
print ('failure on %s' % x)
print(('failure on %s' % x))
stat = 1
sys.exit (stat)
+2 -2
View File
@@ -24,10 +24,10 @@ for soname in ['harfbuzz', 'harfbuzz-subset', 'harfbuzz-gobject', 'harfbuzz-cair
so = os.path.join (libs, 'lib%s.%s' % (soname, suffix))
if not os.path.exists (so): continue
print ('Checking that we are not linking to libstdc++ or libc++ in %s' % so)
print(('Checking that we are not linking to libstdc++ or libc++ in %s' % so))
ldd_result = subprocess.check_output (ldd.split() + [so])
if (b'libstdc++' in ldd_result) or (b'libc++' in ldd_result):
print ('Ouch, %s is linked to libstdc++ or libc++' % so)
print(('Ouch, %s is linked to libstdc++ or libc++' % so))
stat = 1
tested = True
+4 -4
View File
@@ -28,9 +28,9 @@ for obj in OBJS:
if result.returncode:
if result.stderr.find (b'not recognized') != -1:
# https://github.com/harfbuzz/harfbuzz/issues/3019
print ('objdump %s returned "not recognized", skipping' % obj)
print(('objdump %s returned "not recognized", skipping' % obj))
continue
print ('objdump %s returned error:\n%s' % (obj, result.stderr.decode ('utf-8')))
print(('objdump %s returned error:\n%s' % (obj, result.stderr.decode ('utf-8'))))
stat = 2
result = result.stdout.decode ('utf-8')
@@ -38,12 +38,12 @@ for obj in OBJS:
# Checking that no object file has static initializers
for l in re.findall (r'^.*\.[cd]tors.*$', result, re.MULTILINE):
if not re.match (r'.*\b0+\b', l):
print ('Ouch, %s has static initializers/finalizers' % obj)
print(('Ouch, %s has static initializers/finalizers' % obj))
stat = 1
# Checking that no object file has lazy static C++ constructors/destructors or other such stuff
if ('__cxa_' in result) and ('__ubsan_handle' not in result):
print ('Ouch, %s has lazy static C++ constructors/destructors or other such stuff' % obj)
print(('Ouch, %s has lazy static C++ constructors/destructors or other such stuff' % obj))
stat = 1
tested += 1
+5 -5
View File
@@ -42,17 +42,17 @@ for soname in ['harfbuzz', 'harfbuzz-subset', 'harfbuzz-icu', 'harfbuzz-gobject'
prefix = (symprefix + os.path.basename (so)).replace ('libharfbuzz', 'hb').replace ('-', '_').split ('.')[0]
print ('Checking that %s does not expose internal symbols' % so)
print(('Checking that %s does not expose internal symbols' % so))
suspicious_symbols = [x for x in EXPORTED_SYMBOLS if not re.match (r'^%s(_|$)' % prefix, x)]
if suspicious_symbols:
print ('Ouch, internal symbols exposed:', suspicious_symbols)
print(('Ouch, internal symbols exposed:', suspicious_symbols))
stat = 1
def_path = os.path.join (builddir, soname + '.def')
if not os.path.exists (def_path):
print ('\'%s\' not found; skipping' % def_path)
print(('\'%s\' not found; skipping' % def_path))
else:
print ('Checking that %s has the same symbol list as %s' % (so, def_path))
print(('Checking that %s has the same symbol list as %s' % (so, def_path)))
with open (def_path, 'r', encoding='utf-8') as f: def_file = f.read ()
diff_result = list (difflib.context_diff (
def_file.splitlines (),
@@ -62,7 +62,7 @@ for soname in ['harfbuzz', 'harfbuzz-subset', 'harfbuzz-icu', 'harfbuzz-gobject'
))
if diff_result:
print ('\n'.join (diff_result))
print(('\n'.join (diff_result)))
stat = 1
tested = True
+2 -2
View File
@@ -71,7 +71,7 @@ def print_has_arabic_joining (scripts, joining_uu):
print (" {")
for script in sorted ({scripts[u] for u in joining_uu if scripts[u] not in {'Common', 'Inherited'}}):
print (" case HB_SCRIPT_{}:".format (script.upper ()))
print((" case HB_SCRIPT_{}:".format (script.upper ())))
print (" return true;")
print ()
@@ -91,7 +91,7 @@ print (" * on files with these headers:")
print (" *")
for h in headers:
for l in h:
print (" * %s" % (l.strip ()))
print((" * %s" % (l.strip ())))
print (" */")
print ()
print ("#ifndef HB_OT_SHAPER_ARABIC_JOINING_LIST_HH")
+1 -1
View File
@@ -48,7 +48,7 @@ print (" *")
print (" * on file with this header:")
print (" *")
for l in header:
print (" * %s" % (l.strip()))
print((" * %s" % (l.strip())))
print (" */")
print ()
print ("#ifndef HB_UNICODE_EMOJI_TABLE_HH")
+1 -1
View File
@@ -45,6 +45,6 @@ for ranges in all_ranges:
end = ("0x%X" % ranges[1]).rjust(8)
bit = ("%s" % ranges[2]).rjust(3)
print (" {%s, %s, %s}, // %s" % (start, end, bit, ranges[3]))
print((" {%s, %s, %s}, // %s" % (start, end, bit, ranges[3])))
print ("""};""")
+1 -1
View File
@@ -120,7 +120,7 @@ print(" * The following table is generated by running:")
print(" *")
print(" * ./gen-ucd-table.py ucd.nounihan.grouped.xml")
print(" *")
print(" * on file with this description:", ucdxml.description)
print((" * on file with this description:", ucdxml.description))
print(" */")
print()
print("#ifndef HB_UCD_TABLE_HH")
+4 -4
View File
@@ -150,15 +150,15 @@ print ('/* == Start of generated functions == */')
print ('/*')
print (' * The following functions are generated by running:')
print (' *')
print (' * %s ms-use/IndicShapingInvalidCluster.txt Scripts.txt' % sys.argv[0])
print((' * %s ms-use/IndicShapingInvalidCluster.txt Scripts.txt' % sys.argv[0]))
print (' *')
print (' * on files with these headers:')
print (' *')
for line in constraints_header:
print (' * %s' % line.strip ())
print((' * %s' % line.strip ()))
print (' *')
for line in scripts_header:
print (' * %s' % line.strip ())
print((' * %s' % line.strip ()))
print (' */')
print ()
@@ -206,7 +206,7 @@ print (' switch ((unsigned) buffer->props.script)')
print (' {')
for script, constraints in sorted (constraints.items (), key=lambda s_c: script_order[s_c[0]]):
print (' case HB_SCRIPT_{}:'.format (script.upper ()))
print((' case HB_SCRIPT_{}:'.format (script.upper ())))
print (' for (buffer->idx = 0; buffer->idx + 1 < count && buffer->successful;)')
print (' {')
print ('\tbool matched = false;')
+1 -1
View File
@@ -62,4 +62,4 @@ for info, pos in zip (infos, positions):
x_offset = pos.x_offset
y_offset = pos.y_offset
print ("gid%d=%d@%d,%d+%d" % (gid, cluster, x_advance, x_offset, y_offset))
print(("gid%d=%d@%d,%d+%d" % (gid, cluster, x_advance, x_offset, y_offset)))
+3 -3
View File
@@ -166,7 +166,7 @@ def generate_platform_sources():
for plat in platforms:
if os.system("cd skia && GYP_GENERATORS=dump_mozbuild ./gyp_skia -D OS=%s -D host_os=linux gyp/skia_lib.gyp" % plat) != 0:
print 'Failed to generate sources for ' + plat
print('Failed to generate sources for ' + plat)
continue
@@ -308,7 +308,7 @@ def generate_separated_sources(platform_sources):
separated[key].add(value)
if os.system("cd skia && GYP_GENERATORS=dump_mozbuild ./gyp_skia -D OS=linux -D host_os=linux -R pdf gyp/pdf.gyp") != 0:
print 'Failed to generate sources for Skia PDF'
print('Failed to generate sources for Skia PDF')
else:
f = open('skia/sources.json');
separated['pdf'].add('skia/src/core/SkMD5.cpp');
@@ -479,7 +479,7 @@ def write_mozbuild(sources):
f.close()
print 'Wrote ' + filename
print('Wrote ' + filename)
def main():
platform_sources = generate_platform_sources()
+77 -79
View File
@@ -48,7 +48,7 @@ class Struct:
self._name = name
self._entries = []
self._tags = {}
print >>sys.stderr, ' Created struct: %s' % name
print(' Created struct: %s' % name, file=sys.stderr)
def AddEntry(self, entry):
if self._tags.has_key(entry.Tag()):
@@ -58,7 +58,7 @@ class Struct:
self._tags[entry.Tag()], line_count))
self._entries.append(entry)
self._tags[entry.Tag()] = entry.Name()
print >>sys.stderr, ' Added entry: %s' % entry.Name()
print(' Added entry: %s' % entry.Name(), file=sys.stderr)
def Name(self):
return self._name
@@ -72,7 +72,7 @@ class Struct:
def PrintIndented(self, file, ident, code):
"""Takes an array, add indentation to each entry and prints it."""
for entry in code:
print >>file, '%s%s' % (ident, entry)
print('%s%s' % (ident, entry), file=file)
class StructCCode(Struct):
""" Knows how to generate C code for a struct """
@@ -82,20 +82,20 @@ class StructCCode(Struct):
def PrintTags(self, file):
"""Prints the tag definitions for a structure."""
print >>file, '/* Tag definition for %s */' % self._name
print >>file, 'enum %s_ {' % self._name.lower()
print('/* Tag definition for %s */' % self._name, file=file)
print('enum %s_ {' % self._name.lower(), file=file)
for entry in self._entries:
print >>file, ' %s=%d,' % (self.EntryTagName(entry),
entry.Tag())
print >>file, ' %s_MAX_TAGS' % (self._name.upper())
print >>file, '};\n'
print(' %s=%d,' % (self.EntryTagName(entry),
entry.Tag()), file=file)
print(' %s_MAX_TAGS' % (self._name.upper()), file=file)
print('};\n', file=file)
def PrintForwardDeclaration(self, file):
print >>file, 'struct %s;' % self._name
print('struct %s;' % self._name, file=file)
def PrintDeclaration(self, file):
print >>file, '/* Structure declaration for %s */' % self._name
print >>file, 'struct %s_access_ {' % self._name
print('/* Structure declaration for %s */' % self._name, file=file)
print('struct %s_access_ {' % self._name, file=file)
for entry in self._entries:
dcl = entry.AssignDeclaration('(*%s_assign)' % entry.Name())
dcl.extend(
@@ -104,20 +104,19 @@ class StructCCode(Struct):
dcl.extend(
entry.AddDeclaration('(*%s_add)' % entry.Name()))
self.PrintIndented(file, ' ', dcl)
print >>file, '};\n'
print('};\n', file=file)
print >>file, 'struct %s {' % self._name
print >>file, ' struct %s_access_ *base;\n' % self._name
print('struct %s {' % self._name, file=file)
print(' struct %s_access_ *base;\n' % self._name, file=file)
for entry in self._entries:
dcl = entry.Declaration()
self.PrintIndented(file, ' ', dcl)
print >>file, ''
print('', file=file)
for entry in self._entries:
print >>file, ' ev_uint8_t %s_set;' % entry.Name()
print >>file, '};\n'
print(' ev_uint8_t %s_set;' % entry.Name(), file=file)
print('};\n', file=file)
print >>file, \
"""struct %(name)s *%(name)s_new(void);
print("""struct %(name)s *%(name)s_new(void);
struct %(name)s *%(name)s_new_with_arg(void *);
void %(name)s_free(struct %(name)s *);
void %(name)s_clear(struct %(name)s *);
@@ -127,7 +126,7 @@ int %(name)s_complete(struct %(name)s *);
void evtag_marshal_%(name)s(struct evbuffer *, ev_uint32_t,
const struct %(name)s *);
int evtag_unmarshal_%(name)s(struct evbuffer *, ev_uint32_t,
struct %(name)s *);""" % { 'name' : self._name }
struct %(name)s *);""" % { 'name' : self._name }, file=file)
# Write a setting function of every variable
@@ -140,22 +139,21 @@ int evtag_unmarshal_%(name)s(struct evbuffer *, ev_uint32_t,
self.PrintIndented(file, '', entry.AddDeclaration(
entry.AddFuncName()))
print >>file, '/* --- %s done --- */\n' % self._name
print('/* --- %s done --- */\n' % self._name, file=file)
def PrintCode(self, file):
print >>file, ('/*\n'
print(('/*\n'
' * Implementation of %s\n'
' */\n') % self._name
' */\n') % self._name, file=file)
print >>file, \
'static struct %(name)s_access_ __%(name)s_base = {' % \
{ 'name' : self._name }
print('static struct %(name)s_access_ __%(name)s_base = {' % \
{ 'name' : self._name }, file=file)
for entry in self._entries:
self.PrintIndented(file, ' ', entry.CodeBase())
print >>file, '};\n'
print('};\n', file=file)
# Creation
print >>file, (
print((
'struct %(name)s *\n'
'%(name)s_new(void)\n'
'{\n'
@@ -170,77 +168,77 @@ int evtag_unmarshal_%(name)s(struct evbuffer *, ev_uint32_t,
' event_warn("%%s: malloc", __func__);\n'
' return (NULL);\n'
' }\n'
' tmp->base = &__%(name)s_base;\n') % { 'name' : self._name }
' tmp->base = &__%(name)s_base;\n') % { 'name' : self._name }, file=file)
for entry in self._entries:
self.PrintIndented(file, ' ', entry.CodeInitialize('tmp'))
print >>file, ' tmp->%s_set = 0;\n' % entry.Name()
print(' tmp->%s_set = 0;\n' % entry.Name(), file=file)
print >>file, (
print((
' return (tmp);\n'
'}\n')
'}\n'), file=file)
# Adding
for entry in self._entries:
if entry.Array():
self.PrintIndented(file, '', entry.CodeAdd())
print >>file, ''
print('', file=file)
# Assigning
for entry in self._entries:
self.PrintIndented(file, '', entry.CodeAssign())
print >>file, ''
print('', file=file)
# Getting
for entry in self._entries:
self.PrintIndented(file, '', entry.CodeGet())
print >>file, ''
print('', file=file)
# Clearing
print >>file, ( 'void\n'
print(( 'void\n'
'%(name)s_clear(struct %(name)s *tmp)\n'
'{'
) % { 'name' : self._name }
) % { 'name' : self._name }, file=file)
for entry in self._entries:
self.PrintIndented(file, ' ', entry.CodeClear('tmp'))
print >>file, '}\n'
print('}\n', file=file)
# Freeing
print >>file, ( 'void\n'
print(( 'void\n'
'%(name)s_free(struct %(name)s *tmp)\n'
'{'
) % { 'name' : self._name }
) % { 'name' : self._name }, file=file)
for entry in self._entries:
self.PrintIndented(file, ' ', entry.CodeFree('tmp'))
print >>file, (' free(tmp);\n'
'}\n')
print((' free(tmp);\n'
'}\n'), file=file)
# Marshaling
print >>file, ('void\n'
print(('void\n'
'%(name)s_marshal(struct evbuffer *evbuf, '
'const struct %(name)s *tmp)'
'{') % { 'name' : self._name }
'{') % { 'name' : self._name }, file=file)
for entry in self._entries:
indent = ' '
# Optional entries do not have to be set
if entry.Optional():
indent += ' '
print >>file, ' if (tmp->%s_set) {' % entry.Name()
print(' if (tmp->%s_set) {' % entry.Name(), file=file)
self.PrintIndented(
file, indent,
entry.CodeMarshal('evbuf', self.EntryTagName(entry),
entry.GetVarName('tmp'),
entry.GetVarLen('tmp')))
if entry.Optional():
print >>file, ' }'
print(' }', file=file)
print >>file, '}\n'
print('}\n', file=file)
# Unmarshaling
print >>file, ('int\n'
print(('int\n'
'%(name)s_unmarshal(struct %(name)s *tmp, '
' struct evbuffer *evbuf)\n'
'{\n'
@@ -249,14 +247,14 @@ int evtag_unmarshal_%(name)s(struct evbuffer *, ev_uint32_t,
' if (evtag_peek(evbuf, &tag) == -1)\n'
' return (-1);\n'
' switch (tag) {\n'
) % { 'name' : self._name }
) % { 'name' : self._name }, file=file)
for entry in self._entries:
print >>file, ' case %s:\n' % self.EntryTagName(entry)
print(' case %s:\n' % self.EntryTagName(entry), file=file)
if not entry.Array():
print >>file, (
print((
' if (tmp->%s_set)\n'
' return (-1);'
) % (entry.Name())
) % (entry.Name()), file=file)
self.PrintIndented(
file, ' ',
@@ -265,26 +263,26 @@ int evtag_unmarshal_%(name)s(struct evbuffer *, ev_uint32_t,
entry.GetVarName('tmp'),
entry.GetVarLen('tmp')))
print >>file, ( ' tmp->%s_set = 1;\n' % entry.Name() +
' break;\n' )
print >>file, ( ' default:\n'
print(( ' tmp->%s_set = 1;\n' % entry.Name() +
' break;\n' ), file=file)
print(( ' default:\n'
' return -1;\n'
' }\n'
' }\n' )
' }\n' ), file=file)
# Check if it was decoded completely
print >>file, ( ' if (%(name)s_complete(tmp) == -1)\n'
print(( ' if (%(name)s_complete(tmp) == -1)\n'
' return (-1);'
) % { 'name' : self._name }
) % { 'name' : self._name }, file=file)
# Successfully decoded
print >>file, ( ' return (0);\n'
'}\n')
print(( ' return (0);\n'
'}\n'), file=file)
# Checking if a structure has all the required data
print >>file, (
print((
'int\n'
'%(name)s_complete(struct %(name)s *msg)\n'
'{' ) % { 'name' : self._name }
'{' ) % { 'name' : self._name }, file=file)
for entry in self._entries:
if not entry.Optional():
code = [
@@ -297,12 +295,12 @@ int evtag_unmarshal_%(name)s(struct evbuffer *, ev_uint32_t,
self.PrintIndented(
file, ' ',
entry.CodeComplete('msg', entry.GetVarName('msg')))
print >>file, (
print((
' return (0);\n'
'}\n' )
'}\n' ), file=file)
# Complete message unmarshaling
print >>file, (
print((
'int\n'
'evtag_unmarshal_%(name)s(struct evbuffer *evbuf, '
'ev_uint32_t need_tag, struct %(name)s *msg)\n'
@@ -324,10 +322,10 @@ int evtag_unmarshal_%(name)s(struct evbuffer *, ev_uint32_t,
' error:\n'
' evbuffer_free(tmp);\n'
' return (res);\n'
'}\n' ) % { 'name' : self._name }
'}\n' ) % { 'name' : self._name }, file=file)
# Complete message marshaling
print >>file, (
print((
'void\n'
'evtag_marshal_%(name)s(struct evbuffer *evbuf, ev_uint32_t tag, '
'const struct %(name)s *msg)\n'
@@ -337,7 +335,7 @@ int evtag_unmarshal_%(name)s(struct evbuffer *, ev_uint32_t,
' %(name)s_marshal(_buf, msg);\n'
' evtag_marshal_buffer(evbuf, tag, _buf);\n '
' evbuffer_free(_buf);\n'
'}\n' ) % { 'name' : self._name }
'}\n' ) % { 'name' : self._name }, file=file)
class Entry:
def __init__(self, type, name, tag):
@@ -1668,31 +1666,31 @@ class CommandLine:
impl_file = self.impl_file
factory = self.factory
print >>sys.stderr, 'Reading \"%s\"' % filename
print('Reading \"%s\"' % filename, file=sys.stderr)
fp = open(filename, 'r')
entities = Parse(factory, fp)
fp.close()
print >>sys.stderr, '... creating "%s"' % header_file
print('... creating "%s"' % header_file, file=sys.stderr)
header_fp = open(header_file, 'w')
print >>header_fp, factory.HeaderPreamble(filename)
print(factory.HeaderPreamble(filename), file=header_fp)
# Create forward declarations: allows other structs to reference
# each other
for entry in entities:
entry.PrintForwardDeclaration(header_fp)
print >>header_fp, ''
print('', file=header_fp)
for entry in entities:
entry.PrintTags(header_fp)
entry.PrintDeclaration(header_fp)
print >>header_fp, factory.HeaderPostamble(filename)
print(factory.HeaderPostamble(filename), file=header_fp)
header_fp.close()
print >>sys.stderr, '... creating "%s"' % impl_file
print('... creating "%s"' % impl_file, file=sys.stderr)
impl_fp = open(impl_file, 'w')
print >>impl_fp, factory.BodyPreamble(filename, header_file)
print(factory.BodyPreamble(filename, header_file), file=impl_fp)
for entry in entities:
entry.PrintCode(impl_fp)
impl_fp.close()
@@ -1703,15 +1701,15 @@ if __name__ == '__main__':
sys.exit(0)
except RpcGenError, e:
print >>sys.stderr, e
print(e, file=sys.stderr)
sys.exit(1)
except EnvironmentError, e:
if e.filename and e.strerror:
print >>sys.stderr, "%s: %s" % (e.filename, e.strerror)
print("%s: %s" % (e.filename, e.strerror), file=sys.stderr)
sys.exit(1)
elif e.strerror:
print >> sys.stderr, e.strerror
print(e.strerror, file=sys.stderr)
sys.exit(1)
else:
raise
+20 -20
View File
@@ -12,7 +12,7 @@ import ipdl
def log(minv, fmt, *args):
if _verbosity >= minv:
print fmt % args
print(fmt % args)
# process command line
@@ -69,7 +69,7 @@ for (path, dirs, headers) in os.walk(headersdir):
base = os.path.basename(h)
if base in headersmap:
root, ext = os.path.splitext(base)
print >>sys.stderr, 'A protocol named', root, 'exists in multiple namespaces'
print('A protocol named', root, 'exists in multiple namespaces', file=sys.stderr)
sys.exit(1)
headersmap[base] = os.path.join(path, h)
@@ -127,12 +127,12 @@ for f in files:
ast = ipdl.parse(specstring, filename, includedirs=includedirs)
if ast is None:
print >>sys.stderr, 'Specification could not be parsed.'
print('Specification could not be parsed.', file=sys.stderr)
sys.exit(1)
log(2, 'checking types')
if not ipdl.typecheck(ast):
print >>sys.stderr, 'Specification is not well typed.'
print('Specification is not well typed.', file=sys.stderr)
sys.exit(1)
if _verbosity > 2:
@@ -154,30 +154,30 @@ allprotocols.sort()
ipcmsgstart = StringIO()
print >>ipcmsgstart, """
print("""
// CODE GENERATED by ipdl.py. Do not edit.
#ifndef IPCMessageStart_h
#define IPCMessageStart_h
enum IPCMessageStart {
"""
""", file=ipcmsgstart)
for name in allprotocols:
print >>ipcmsgstart, " %s," % name
print >>ipcmsgstart, " %sChild," % name
print(" %s," % name, file=ipcmsgstart)
print(" %sChild," % name, file=ipcmsgstart)
print >>ipcmsgstart, """
print("""
LastMsgIndex
};
static_assert(LastMsgIndex <= 65536, "need to update IPC_MESSAGE_MACRO");
#endif // ifndef IPCMessageStart_h
"""
""", file=ipcmsgstart)
ipc_msgtype_name = StringIO()
print >>ipc_msgtype_name, """
print("""
// CODE GENERATED by ipdl.py. Do not edit.
#include <cstdint>
@@ -188,16 +188,16 @@ using std::uint32_t;
namespace {
enum IPCMessages {
"""
""", file=ipc_msgtype_name)
for protocol in sorted(allmessages.keys()):
for (msg, num) in allmessages[protocol].idnums:
if num:
print >>ipc_msgtype_name, " %s = %s," % (msg, num)
print(" %s = %s," % (msg, num), file=ipc_msgtype_name)
elif not msg.endswith('End'):
print >>ipc_msgtype_name, " %s__%s," % (protocol, msg)
print(" %s__%s," % (protocol, msg), file=ipc_msgtype_name)
print >>ipc_msgtype_name, """
print("""
};
} // anonymous namespace
@@ -208,17 +208,17 @@ namespace ipc {
const char* StringFromIPCMessageType(uint32_t aMessageType)
{
switch (aMessageType) {
"""
""", file=ipc_msgtype_name)
for protocol in sorted(allmessages.keys()):
for (msg, num) in allmessages[protocol].idnums:
if num or msg.endswith('End'):
continue
print >>ipc_msgtype_name, """
print("""
case %s__%s:
return "%s::%s";""" % (protocol, msg, protocol, msg)
return "%s::%s";""" % (protocol, msg, protocol, msg), file=ipc_msgtype_name)
print >>ipc_msgtype_name, """
print("""
default:
return "???";
}
@@ -226,7 +226,7 @@ print >>ipc_msgtype_name, """
} // namespace ipc
} // namespace mozilla
"""
""", file=ipc_msgtype_name)
ipdl.writeifmodified(ipcmsgstart.getvalue(), ipcmessagestartpath)
ipdl.writeifmodified(ipc_msgtype_name.getvalue(), ipc_msgtype_name_path)
+1 -1
View File
@@ -79,7 +79,7 @@ class Parser:
ast = self.parser.parse(input=input, lexer=self.lexer,
debug=self.debug)
except ParseError, p:
print >>errout, p
print(p, file=errout)
return None
Parser.current = Parser.parseStack.pop()
+11 -11
View File
@@ -647,7 +647,7 @@ With this information, it finally type checks the AST.'''
def reportErrors(self, errout):
for error in self.errors:
print >>errout, error
print(error, file=errout)
class TcheckVisitor(Visitor):
@@ -1879,19 +1879,19 @@ class CheckProcessGraph(TcheckVisitor):
# is a dag
def visitTranslationUnit(self, tu):
if 0:
print 'Processes'
print('Processes')
for process in ProcessGraph.processes:
print ' ', process
print(' ', process)
for edge in process.iteredges():
print ' ', edge
print 'Bridges'
print(' ', edge)
print('Bridges')
for bridgeList in ProcessGraph.bridges.itervalues():
for bridge in bridgeList:
print ' ', bridge
print 'Opens'
print(' ', bridge)
print('Opens')
for opensList in ProcessGraph.opens.itervalues():
for opens in opensList:
print ' ', opens
print(' ', opens)
##-----------------------------------------------------------------------------
@@ -2088,19 +2088,19 @@ direction as trigger |t|'''
errT2 = None
if 0 == len(U1) or 0 == len(U2):
print "******* case 1"
print("******* case 1")
raceError = True
elif 1 < len(U1) or 1 < len(U2):
raceError = True
# there are potentially many unpaired states; just
# pick two
print "******* case 2"
print("******* case 2")
for u1, u2 in cartesian_product(U1, U2):
if u1 != u2:
errT1, errT2 = u1, u2
break
elif U1 != U2:
print "******* case 3"
print("******* case 3")
raceError = True
for errT1 in U1: pass
for errT2 in U2: pass
+2 -2
View File
@@ -5,7 +5,7 @@
import string, sys
def usage():
print >>sys.stderr, """
print("""
%s template_file -t unit_tests... -e extra_protocols...
TEMPLATE_FILE is used to generate to generate the unit-tester .cpp
@@ -13,7 +13,7 @@ def usage():
EXTRA_PROTOCOLS are top-level protocols for subprocesses that can be
spawned in tests but are not unit tests in and of
themselves
"""% (sys.argv[0])
"""% (sys.argv[0]), file=sys.stderr)
sys.exit(1)
def main(argv):
+2 -2
View File
@@ -19,11 +19,11 @@ from shutil import rmtree
topsrcdir, chromiumtree, rev = sys.argv[1:]
if not os.path.exists(os.path.join(topsrcdir, 'client.py')):
print >>sys.stderr, "Incorrect topsrcdir"
print("Incorrect topsrcdir", file=sys.stderr)
sys.exit(1)
if not os.path.exists(os.path.join(chromiumtree, 'src/DEPS')):
print >>sys.stderr, "Incorrect chromium directory, missing DEPS"
print("Incorrect chromium directory, missing DEPS", file=sys.stderr)
sys.exit(1)
check_call(['gclient', 'sync', '--force', '--revision=src@%s' % rev], cwd=chromiumtree)
+1 -1
View File
@@ -109,7 +109,7 @@ def preprocess(cxx, preprocessorOption, source, args = []):
with open(tmpIn, 'wb') as input:
input.write(source)
print(' '.join(cxx + outputArg + args + [tmpIn]))
print((' '.join(cxx + outputArg + args + [tmpIn])))
result = subprocess.Popen(cxx + outputArg + args + [tmpIn]).wait()
if (result != 0):
sys.exit(result);
+5 -5
View File
@@ -106,7 +106,7 @@ def set_vars_from_script(script, vars):
var, value = m.groups()
if var in tograb:
env[var] = value
print("Setting %s = %s" % (var, value))
print(("Setting %s = %s" % (var, value)))
if var.startswith("ORIGINAL_"):
originals[var[9:]] = value
@@ -359,7 +359,7 @@ if 'jstests' in test_suites:
# FIXME bug 1291449: This would be unnecessary if we could run msan with -mllvm
# -msan-keep-going, but in clang 3.8 it causes a hang during compilation.
if variant.get('ignore-test-failures'):
print("Ignoring test results %s" % (results,))
print(("Ignoring test results %s" % (results,)))
results = [0]
if args.variant in ('tsan', 'msan'):
@@ -384,11 +384,11 @@ if args.variant in ('tsan', 'msan'):
summary_filename = os.path.join(env['MOZ_UPLOAD_DIR'], "%s_summary.txt" % args.variant)
with open(summary_filename, 'wb') as outfh:
for location, count in sites.most_common():
print >> outfh, "%d %s" % (count, location)
print(open(summary_filename, 'rb').read())
print("%d %s" % (count, location), file=outfh)
print((open(summary_filename, 'rb').read()))
if 'max-errors' in variant:
print("Found %d errors out of %d allowed" % (len(sites), variant['max-errors']))
print(("Found %d errors out of %d allowed" % (len(sites), variant['max-errors'])))
if len(sites) > variant['max-errors']:
results.append(1)
+6 -6
View File
@@ -82,7 +82,7 @@ def run_tests(tests, test_dir):
fmt = '%20s: {"TMax": %4.1f, "TAvg": %4.1f, "MMax": %4.1f, "MAvg": %4.1f, "SMax": %4.1f, "SAvg": %4.1f}'
if (i != len(tests) - 1):
fmt += ','
print(fmt %(filename_str ,TMax, TAvg, MMax, MAvg, SMax, MAvg))
print((fmt %(filename_str ,TMax, TAvg, MMax, MAvg, SMax, MAvg)))
except KeyboardInterrupt:
print('fail')
@@ -95,7 +95,7 @@ def compare(current, baseline):
try:
baseline_result = baseline[key]
except KeyError:
print key, 'missing from baseline'
print(key, 'missing from baseline')
continue
val_getter = itemgetter('TMax', 'TAvg', 'MMax', 'MAvg', 'SMax', 'SAvg')
@@ -113,9 +113,9 @@ def compare(current, baseline):
result = 'SLOWER: %6.2f > baseline %6.2f (%+6.2f%%) ' % \
(CTAvg, BTAvg, slowdown)
percent_speedups.append(slowdown)
print '%30s: %s' % (key, result)
print('%30s: %s' % (key, result))
if percent_speedups:
print 'Average speedup: %.2f%%' % avg(percent_speedups)
print('Average speedup: %.2f%%' % avg(percent_speedups))
if __name__ == '__main__':
script_path = os.path.abspath(__file__)
@@ -141,7 +141,7 @@ if __name__ == '__main__':
test_list = find_tests(test_dir)
if not test_list:
print >> sys.stderr, "No tests found matching command line arguments."
print("No tests found matching command line arguments.", file=sys.stderr)
sys.exit(0)
test_list = [ Test.from_file(tst, name, OPTIONS) for tst, name in test_list ]
@@ -153,7 +153,7 @@ if __name__ == '__main__':
except OSError:
if not os.path.exists(JS):
print >> sys.stderr, "JS shell argument: file does not exist: '%s'"%JS
print("JS shell argument: file does not exist: '%s'"%JS, file=sys.stderr)
sys.exit(1)
else:
raise
+5 -5
View File
@@ -61,7 +61,7 @@ def print_command(command, outfile=None, env=None):
outputs.append("%s='%s'" % (key, value))
output = ' '.join(outputs) + " " + output
print output
print(output)
def generate_hazards(config, outfilename):
jobs = []
@@ -150,7 +150,7 @@ def out_indexes(command):
def run_job(name, config):
cmdspec, outfiles = JOBS[name]
print("Running " + name + " to generate " + str(outfiles))
print(("Running " + name + " to generate " + str(outfiles)))
if hasattr(cmdspec, '__call__'):
cmdspec(config, outfiles)
else:
@@ -188,7 +188,7 @@ def run_job(name, config):
try:
os.rename(temp, final)
except OSError:
print("Error renaming %s -> %s" % (temp, final))
print(("Error renaming %s -> %s" % (temp, final)))
raise
config = { 'ANALYSIS_SCRIPTDIR': os.path.dirname(__file__) }
@@ -226,7 +226,7 @@ for default in defaults:
try:
execfile(default, config)
if args.verbose:
print("Loaded %s" % default)
print(("Loaded %s" % default))
except:
pass
@@ -272,7 +272,7 @@ if args.list:
for step in steps:
command, outfilename = JOBS[step]
if outfilename:
print("%s -> %s" % (step, outfilename))
print(("%s -> %s" % (step, outfilename)))
else:
print(step)
sys.exit(0)
+12 -12
View File
@@ -34,20 +34,20 @@ try:
m = re.match(r'^Time: (.*)', line)
mm = re.match(r'^Run on:', line)
if m or mm:
print >>hazards, line
print >>extra, line
print >>refs, line
print(line, file=hazards)
print(line, file=extra)
print(line, file=refs)
continue
m = re.match(r'^Function.*has unnecessary root', line)
if m:
print >>extra, line
print(line, file=extra)
continue
m = re.match(r'^Function.*takes unsafe address of unrooted', line)
if m:
num_refs += 1
print >>refs, line
print(line, file=refs)
continue
m = re.match(r"^Function.*has unrooted.*of type.*live across GC call ('?)(.*?)('?) at \S+:\d+$", line)
@@ -90,14 +90,14 @@ try:
gcHazards = hazardousGCFunctions[gcFunction]
if gcFunction in gcExplanations:
print >>hazards, (gcHazards[index] + gcExplanations[gcFunction])
print((gcHazards[index] + gcExplanations[gcFunction]), file=hazards)
else:
print >>hazards, gcHazards[index]
print(gcHazards[index], file=hazards)
except IOError as e:
print 'Failed: %s' % str(e)
print('Failed: %s' % str(e))
print("Wrote %s" % args.hazards)
print("Wrote %s" % args.extra)
print("Wrote %s" % args.refs)
print("Found %d hazards and %d unsafe references" % (num_hazards, num_refs))
print(("Wrote %s" % args.hazards))
print(("Wrote %s" % args.extra))
print(("Wrote %s" % args.refs))
print(("Found %d hazards and %d unsafe references" % (num_hazards, num_refs)))
+1 -1
View File
@@ -86,4 +86,4 @@ for name in cfg.tests:
os.chdir(outdir)
subprocess.call(["sh", "-c", "rm *.xdb"])
execfile(os.path.join(indir, "test.py"), {'test': test, 'equal': equal})
print("TEST-PASSED: %s" % name)
print(("TEST-PASSED: %s" % name))
@@ -22,7 +22,7 @@ assert('<returnvalue>' in hazmap)
# All hazards should be in f() and loopy()
assert(hazmap['cell2'].function == 'Cell* f()')
print(len(set(haz.function for haz in hazards)))
print((len(set(haz.function for haz in hazards))))
assert(len(set(haz.function for haz in hazards)) == 2)
# Check that the correct GC call is reported for each hazard. (cell3 has a
+3 -3
View File
@@ -13,7 +13,7 @@ HazardSummary = namedtuple('HazardSummary', ['function', 'variable', 'type', 'GC
def equal(got, expected):
if got != expected:
print("Got '%s', expected '%s'" % (got, expected))
print(("Got '%s', expected '%s'" % (got, expected)))
def extract_unmangled(func):
return func.split('$')[-1]
@@ -37,7 +37,7 @@ class Test(object):
CXX=self.cfg.cxx, sixgill=self.cfg.sixgill_plugin,
options=options)
if self.cfg.verbose:
print("Running %s" % cmd)
print(("Running %s" % cmd))
subprocess.check_call(["sh", "-c", cmd])
def load_db_entry(self, dbname, pattern):
@@ -69,7 +69,7 @@ sixgill_bin = '{bindir}'
cmd.append("--js=%s" % self.cfg.js)
if self.cfg.verbose:
cmd.append("--verbose")
print("Running " + " ".join(cmd))
print(("Running " + " ".join(cmd)))
subprocess.check_call(cmd)
def computeGCTypes(self):
+3 -3
View File
@@ -104,7 +104,7 @@ class Summary(object):
if self.failures:
print "tests failed:"
print("tests failed:")
for test in self.failures:
test.show(sys.stdout)
@@ -129,7 +129,7 @@ class Summary(object):
sys.exit(1)
if self.timeouts:
print "tests timed out:"
print("tests timed out:")
for test in self.timeouts:
test.show(sys.stdout)
@@ -187,7 +187,7 @@ class Test(TaskPool.Task):
self.summary.timeout(self)
def show_cmd(self, out):
print "Command: ", make_shell_cmd(self.cmd())
print("Command: ", make_shell_cmd(self.cmd()))
def show_output(self, out):
if self.stdout:
+5 -5
View File
@@ -203,17 +203,17 @@ if __name__ == '__main__':
def cmd(self):
return ['sh', '-c', 'echo out; sleep %d; echo err>&2' % (self.n,)]
def onStdout(self, text):
print '%d stdout: %r' % (self.n, text)
print('%d stdout: %r' % (self.n, text))
def onStderr(self, text):
print '%d stderr: %r' % (self.n, text)
print('%d stderr: %r' % (self.n, text))
def onFinished(self, returncode):
print '%d (rc=%d)' % (self.n, returncode)
print('%d (rc=%d)' % (self.n, returncode))
sorted.append(self.n)
def onTimeout(self):
print '%d timed out' % (self.n,)
print('%d timed out' % (self.n,))
p = TaskPool([SortableTask(_) for _ in ns], job_limit=len(ns), timeout=timeout)
p.run_all()
return sorted
print repr(sleep_sort([1,1,2,3,5,8,13,21,34], 15))
print(repr(sleep_sort([1,1,2,3,5,8,13,21,34], 15)))
+1 -1
View File
@@ -21,7 +21,7 @@ def do_unwinder_test():
found_outer = False
frames = list(gdb.frames.execute_frame_filters(gdb.newest_frame(), 0, -1))
for frame in frames:
print("examining " + frame.function())
print(("examining " + frame.function()))
if first:
assert_eq(frame.function().startswith("Something"), True)
first = False
+2 -2
View File
@@ -27,6 +27,6 @@ def encodeDouble(value):
cdefgh = value & 0x3f
return (a << 31) | (B << 30) | (rep(b, 8) << 22) | cdefgh << 16
print '/* THIS FILE IS AUTOMATICALLY GENERATED BY gen-double-encode-table.py. */'
print('/* THIS FILE IS AUTOMATICALLY GENERATED BY gen-double-encode-table.py. */')
for i in range(256):
print ' { 0x%08x, { %d, %d, 0 } },' % (encodeDouble(i), i & 0xf, i >> 4)
print(' { 0x%08x, { %d, %d, 0 } },' % (encodeDouble(i), i & 0xf, i >> 4))
+2 -2
View File
@@ -25,7 +25,7 @@ def spawn_test(test, prefix, passthrough, run_skipped, show_cmd):
cmd = test.get_command(prefix)
if show_cmd:
print(escape_cmdline(cmd))
print((escape_cmdline(cmd)))
if not passthrough:
(rout, wout) = os.pipe()
@@ -107,7 +107,7 @@ def read_input(tasks, timeout):
try:
readable, _, _ = select.select(rlist, [], exlist, timeout)
except OverflowError as e:
print >> sys.stderr, "timeout value", timeout
print("timeout value", timeout, file=sys.stderr)
raise
for fd in readable:
+1 -1
View File
@@ -43,7 +43,7 @@ JITFLAGS = {
def get_jitflags(variant, **kwargs):
if variant not in JITFLAGS:
print('Invalid jitflag: "{}"'.format(variant))
print(('Invalid jitflag: "{}"'.format(variant)))
sys.exit(1)
if variant == 'none' and 'none' in kwargs:
return kwargs['none']
+24 -24
View File
@@ -65,7 +65,7 @@ class np:
def parse_p(tok):
if tok[-2:] == "px":
return float(tok[:-2])
print "Whoops, not a pixel value " + tok
print("Whoops, not a pixel value " + tok)
def parse_np(tok):
if tok[-2:] == "px":
@@ -121,47 +121,47 @@ def normalise(props):
def check_parse(props):
if not hasattr(props, 'source'):
print "missing border-image-source"
print("missing border-image-source")
return False
if not hasattr(props.size, 'width'):
print "missing width"
print("missing width")
return False
if not hasattr(props.size, 'height'):
print "missing height"
print("missing height")
return False
if not hasattr(props, 'width'):
print "missing border-width"
print("missing border-width")
return False
if not hasattr(props, 'image_width'):
print "missing border-image-width"
print("missing border-image-width")
return False
if not hasattr(props, 'slice'):
print "missing border-image-slice"
print("missing border-image-slice")
return False
if not hasattr(props, 'repeat') or (props.repeat not in ["stretch", "repeat", "round"]):
print "missing or incorrect border-image-repeat '" + props.repeat + "'"
print("missing or incorrect border-image-repeat '" + props.repeat + "'")
return False
if not hasattr(props, 'outset'):
print "missing border-image-outset"
print("missing border-image-outset")
return False
return True
def check_normalise(props):
if not hasattr(props, 'source'):
print "missing border-image-source"
print("missing border-image-source")
return False
if not hasattr(props.size, 'width'):
print "missing width"
print("missing width")
return False
if not hasattr(props.size, 'height'):
print "missing height"
print("missing height")
return False
if not hasattr(props, 'slice'):
print "missing border-image-slice"
print("missing border-image-slice")
return False
if not hasattr(props, 'repeat') or (props.repeat not in ["stretch", "repeat", "round"]):
print "missing or incorrect border-image-repeat '" + props.repeat + "'"
print("missing or incorrect border-image-repeat '" + props.repeat + "'")
return False
return True
@@ -239,7 +239,7 @@ def compute(props):
for t in [tiles[i] for i in [3, 4, 5]]:
t.scale.y = dest_tile_size.height/t.slice.height()
else:
print "Whoops, invalid border-image-repeat value"
print("Whoops, invalid border-image-repeat value")
# catch overlapping slices. Its easier to deal with it here than to catch
# earlier and have to avoid all the divide by zeroes above
@@ -312,34 +312,34 @@ def compute(props):
dest_tiles[(i+1)*tiles_h-2].dest_size.width -= diff_h
# output the table to simulate the border
print "<table>"
print("<table>")
for i in range(tiles_h):
print "<col style=\"width: " + str(dest_tiles[i].dest_size.width) + "px;\">"
print("<col style=\"width: " + str(dest_tiles[i].dest_size.width) + "px;\">")
for i in range(tiles_v):
print "<tr style=\"height: " + str(dest_tiles[i*tiles_h].dest_size.height) + "px;\">"
print("<tr style=\"height: " + str(dest_tiles[i*tiles_h].dest_size.height) + "px;\">")
for j in range(tiles_h):
width = dest_tiles[i*tiles_h+j].size.width
height = dest_tiles[i*tiles_h+j].size.height
# catch any tiles with negative widths/heights
# this happends when the total of the border-image-slices > borde drawing area
if width <= 0 or height <= 0:
print " <td style=\"background: white;\"></td>"
print(" <td style=\"background: white;\"></td>")
else:
print " <td style=\"background-image: " + props.source + "; background-size: " + str(width) + "px " + str(height) + "px; background-position: " + str(dest_tiles[i*tiles_h+j].offset.x) + "px " + str(dest_tiles[i*tiles_h+j].offset.y) + "px;\"></td>"
print "</tr>"
print "</table>"
print(" <td style=\"background-image: " + props.source + "; background-size: " + str(width) + "px " + str(height) + "px; background-position: " + str(dest_tiles[i*tiles_h+j].offset.x) + "px " + str(dest_tiles[i*tiles_h+j].offset.y) + "px;\"></td>")
print("</tr>")
print("</table>")
# start here
args = sys.argv[1:]
if len(args) == 0:
print "whoops: no source file"
print("whoops: no source file")
exit(1)
props = parse(args[0])
if not check_parse(props):
print dir(props)
print(dir(props))
exit(1)
props = normalise(props)
if not check_normalise(props):
@@ -474,13 +474,13 @@ def makeJavascriptData():
# build fonts
print "Making lookup type 1 font..."
print("Making lookup type 1 font...")
makeLookup1()
print "Making lookup type 3 font..."
print("Making lookup type 3 font...")
makeLookup3()
# output javascript data
print "Making javascript data file..."
print("Making javascript data file...")
makeJavascriptData()
@@ -62,7 +62,7 @@ def write_file(filename, content):
with open(filename, 'wb') as f:
f.write(content.encode('UTF-8'))
print("# START tests from {}".format(__file__))
print(("# START tests from {}".format(__file__)))
idx = 0
for (pos, emphasis_pos, ruby_pos, wms, dir) in POSITIONS:
idx += 1
@@ -78,5 +78,5 @@ for (pos, emphasis_pos, ruby_pos, wms, dir) in POSITIONS:
pos=pos, wm=wm, tag=tag, index=idx, dir=dir,
start=start.format(style1=style1, style2=STYLE2), end=end)
write_file(test_file, content)
print("== {} {}".format(test_file, ref_file))
print("# END tests from {}".format(__file__))
print(("== {} {}".format(test_file, ref_file)))
print(("# END tests from {}".format(__file__)))
@@ -72,8 +72,8 @@ for wm in WRITING_MODES:
if wm != "horizontal-tb":
write_test_files(wm, "sideways", pos1, pos2)
print("# START tests from {}".format(__file__))
print(("# START tests from {}".format(__file__)))
reftest_items.sort()
for item in reftest_items:
print(item)
print("# END tests from {}".format(__file__))
print(("# END tests from {}".format(__file__)))
@@ -52,7 +52,7 @@ def write_file(filename, content):
with open(filename, 'wb') as f:
f.write(content.encode('UTF-8'))
print("# START tests from {}".format(__file__))
print(("# START tests from {}".format(__file__)))
idx = 0
for pos, ref_wm, ruby_pos, subtests in TEST_CASES:
idx += 1
@@ -65,5 +65,5 @@ for pos, ref_wm, ruby_pos, subtests in TEST_CASES:
test_content = TEST_TEMPLATE.format(
wm=wm, pos=pos, index=idx, ruby_pos=ruby_pos, posval=posval)
write_file(test_file, test_content)
print("== {} {}".format(test_file, ref_file))
print("# END tests from {}".format(__file__))
print(("== {} {}".format(test_file, ref_file)))
print(("# END tests from {}".format(__file__)))
@@ -59,7 +59,7 @@ def write_test_file(idx, suffix, style, code, name=None):
char=get_html_entity(code),
code='U+{:04X}'.format(code),
title=name))
print("== {} {}".format(filename, REF_FILE.format(idx)))
print(("== {} {}".format(filename, REF_FILE.format(idx))))
idx = 10
def write_files(style, code):
@@ -77,9 +77,9 @@ def write_files(style, code):
if shape == 'circle':
write_test_file(idx, next(suffix), fill, code, fill + ', horizontal')
print("# START tests from {}".format(__file__))
print(("# START tests from {}".format(__file__)))
for name, code, _ in DATA_SET:
write_files(('filled', name), code)
for name, _, code in DATA_SET:
write_files(('open', name), code)
print("# END tests from {}".format(__file__))
print(("# END tests from {}".format(__file__)))
+2 -2
View File
@@ -149,7 +149,7 @@ class ReftestRunner(MozbuildObject):
import runreftestmulet
if self.substs.get('ENABLE_MARIONETTE') != '1':
print(MARIONETTE_DISABLED % self.mozconfig['path'])
print((MARIONETTE_DISABLED % self.mozconfig['path']))
return 1
if not args.profile:
@@ -161,7 +161,7 @@ class ReftestRunner(MozbuildObject):
if os.path.isfile(os.path.join(args.profile, 'extensions',
'httpd@gaiamobile.org')):
print(GAIA_PROFILE_IS_DEBUG % args.profile)
print((GAIA_PROFILE_IS_DEBUG % args.profile))
return 1
args.app = self.get_binary_path()
+22 -22
View File
@@ -30,7 +30,7 @@ class RemoteReftestResolver(ReftestResolver):
elif os.path.exists(os.path.abspath(path)):
rv = os.path.abspath(path)
else:
print >> sys.stderr, "Could not find manifest %s" % script_abs_path
print("Could not find manifest %s" % script_abs_path, file=sys.stderr)
sys.exit(1)
return os.path.normpath(rv)
@@ -88,7 +88,7 @@ class ReftestServer:
self._process = self.automation.Process([xpcshell] + args, env = env)
pid = self._process.pid
if pid < 0:
print "TEST-UNEXPECTED-FAIL | remotereftests.py | Error starting server."
print("TEST-UNEXPECTED-FAIL | remotereftests.py | Error starting server.")
return 2
self.automation.log.info("INFO | remotereftests.py | Server pid: %d", pid)
@@ -108,7 +108,7 @@ class ReftestServer:
time.sleep(1)
i += 1
else:
print "TEST-UNEXPECTED-FAIL | remotereftests.py | Timed out while waiting for server startup."
print("TEST-UNEXPECTED-FAIL | remotereftests.py | Timed out while waiting for server startup.")
self.stop()
return 1
@@ -186,7 +186,7 @@ class RemoteReftest(RefTest):
paths = [options.xrePath, localAutomation.DIST_BIN, self.automation._product, os.path.join('..', self.automation._product)]
options.xrePath = self.findPath(paths)
if options.xrePath == None:
print "ERROR: unable to find xulrunner path for %s, please specify with --xre-path" % (os.name)
print("ERROR: unable to find xulrunner path for %s, please specify with --xre-path" % (os.name))
return 1
paths.append("bin")
paths.append(os.path.join("..", "bin"))
@@ -199,7 +199,7 @@ class RemoteReftest(RefTest):
paths.insert(0, options.utilityPath)
options.utilityPath = self.findPath(paths, xpcshell)
if options.utilityPath == None:
print "ERROR: unable to find utility path for %s, please specify with --utility-path" % (os.name)
print("ERROR: unable to find utility path for %s, please specify with --utility-path" % (os.name))
return 1
options.serverProfilePath = tempfile.mkdtemp()
@@ -244,7 +244,7 @@ class RemoteReftest(RefTest):
self._devicemanager.pushDir(profileDir, options.remoteProfile)
self._devicemanager.chmodDir(options.remoteProfile)
except mozdevice.DMError:
print "Automation Error: Failed to copy profiledir to device"
print("Automation Error: Failed to copy profiledir to device")
raise
return profile
@@ -256,26 +256,26 @@ class RemoteReftest(RefTest):
self._devicemanager.pushDir(profileDir, options.remoteProfile)
self._devicemanager.chmodDir(options.remoteProfile)
except mozdevice.DMError:
print "Automation Error: Failed to copy extra files to device"
print("Automation Error: Failed to copy extra files to device")
raise
def printDeviceInfo(self, printLogcat=False):
try:
if printLogcat:
logcat = self._devicemanager.getLogcat(filterOutRegexps=fennecLogcatFilters)
print ''.join(logcat)
print "Device info:"
print(''.join(logcat))
print("Device info:")
devinfo = self._devicemanager.getInfo()
for category in devinfo:
if type(devinfo[category]) is list:
print " %s:" % category
print(" %s:" % category)
for item in devinfo[category]:
print " %s" % item
print(" %s" % item)
else:
print " %s: %s" % (category, devinfo[category])
print "Test root: %s" % self._devicemanager.deviceRoot
print(" %s: %s" % (category, devinfo[category]))
print("Test root: %s" % self._devicemanager.deviceRoot)
except mozdevice.DMError:
print "WARNING: Error getting device information"
print("WARNING: Error getting device information")
def environment(self, **kwargs):
return self.automation.environment(**kwargs)
@@ -308,8 +308,8 @@ class RemoteReftest(RefTest):
self._devicemanager.fileExists(self.remoteLogFile):
self._devicemanager.getFile(self.remoteLogFile, self.localLogName)
else:
print "WARNING: Unable to retrieve log file (%s) from remote " \
"device" % self.remoteLogFile
print("WARNING: Unable to retrieve log file (%s) from remote " \
"device" % self.remoteLogFile)
self._devicemanager.removeDir(self.remoteProfile)
self._devicemanager.removeDir(self.remoteTestRoot)
RefTest.cleanup(self, profileDir)
@@ -318,12 +318,12 @@ class RemoteReftest(RefTest):
os.remove(self.pidFile)
os.remove(self.pidFile + ".xpcshell.pid")
except:
print "Warning: cleaning up pidfile '%s' was unsuccessful from the test harness" % self.pidFile
print("Warning: cleaning up pidfile '%s' was unsuccessful from the test harness" % self.pidFile)
def run_test_harness(parser, options):
if options.dm_trans == 'sut' and options.deviceIP == None:
print "Error: If --dm_trans = sut, you must provide a device IP to connect to via the --deviceIP option"
print("Error: If --dm_trans = sut, you must provide a device IP to connect to via the --deviceIP option")
return 1
dm_args = {
@@ -343,7 +343,7 @@ def run_test_harness(parser, options):
dm = dm_cls(**dm_args)
except mozdevice.DMError:
traceback.print_exc()
print "Automation Error: exception while initializing devicemanager. Most likely the device is not in a testable state."
print("Automation Error: exception while initializing devicemanager. Most likely the device is not in a testable state.")
return 1
automation = RemoteAutomation(None)
@@ -359,7 +359,7 @@ def run_test_harness(parser, options):
expected = options.app.split('/')[-1]
installed = dm.shellCheckOutput(['pm', 'list', 'packages', expected])
if expected not in installed:
print "%s is not installed on this device" % expected
print("%s is not installed on this device" % expected)
return 1
automation.setAppName(options.app)
@@ -369,7 +369,7 @@ def run_test_harness(parser, options):
parser.validate(options, reftest)
if mozinfo.info['debug']:
print "changing timeout for remote debug reftests from %s to 600 seconds" % options.timeout
print("changing timeout for remote debug reftests from %s to 600 seconds" % options.timeout)
options.timeout = 600
# Hack in a symbolic link for jsreftest
@@ -394,7 +394,7 @@ def run_test_harness(parser, options):
dm.recordLogcat()
retVal = reftest.runTests(options.tests, options)
except:
print "Automation Error: Exception caught while running tests"
print("Automation Error: Exception caught while running tests")
traceback.print_exc()
retVal = 1
+6 -6
View File
@@ -85,12 +85,12 @@ class ReftestThread(threading.Thread):
def run(self):
with printLock:
print "Starting thread with", self.cmdargs
print("Starting thread with", self.cmdargs)
sys.stdout.flush()
process = subprocess.Popen(self.cmdargs, stdout=subprocess.PIPE)
for chunk in self.chunkForMergedOutput(process.stdout):
with printLock:
print chunk,
print(chunk, end=' ')
sys.stdout.flush()
self.retcode = process.wait()
@@ -303,7 +303,7 @@ class RefTest(object):
for v in options.extraPrefs:
thispref = v.split('=')
if len(thispref) < 2:
print "Error: syntax error in --setpref=" + v
print("Error: syntax error in --setpref=" + v)
sys.exit(1)
prefs[thispref[0]] = thispref[1].strip()
@@ -362,7 +362,7 @@ class RefTest(object):
for v in options.environment:
ix = v.find("=")
if ix <= 0:
print "Error: syntax error in --setenv=" + v
print("Error: syntax error in --setenv=" + v)
return None
browserEnv[v[:ix]] = v[ix + 1:]
@@ -498,11 +498,11 @@ class RefTest(object):
threadMatches.group('total') if threadMatches else 0)
summaryObj['total'] += amount
print 'REFTEST INFO | Result summary:'
print('REFTEST INFO | Result summary:')
for (summaryObj, (text, categories)) in zip(summaryObjects, summaryLines):
details = ', '.join(["%d %s" % (summaryObj[attribute], description) for (
attribute, description) in categories])
print 'REFTEST INFO | ' + text + ': ' + str(summaryObj['total']) + ' (' + details + ')'
print('REFTEST INFO | ' + text + ': ' + str(summaryObj['total']) + ' (' + details + ')')
return int(any(t.retcode != 0 for t in threads))
+9 -9
View File
@@ -84,7 +84,7 @@ class B2GRemoteReftest(RefTest):
try:
self._devicemanager.getFile(self.remoteLogFile, self.localLogName)
except:
print "ERROR: We were not able to retrieve the info from %s" % self.remoteLogFile
print("ERROR: We were not able to retrieve the info from %s" % self.remoteLogFile)
sys.exit(5)
# Delete any bundled extensions
@@ -121,7 +121,7 @@ class B2GRemoteReftest(RefTest):
os.remove(self.pidFile)
os.remove(self.pidFile + ".xpcshell.pid")
except:
print "Warning: cleaning up pidfile '%s' was unsuccessful from the test harness" % self.pidFile
print("Warning: cleaning up pidfile '%s' was unsuccessful from the test harness" % self.pidFile)
def findPath(self, paths, filename = None):
for path in paths:
@@ -158,7 +158,7 @@ class B2GRemoteReftest(RefTest):
os.path.join('..', self.automation._product)]
options.xrePath = self.findPath(paths)
if options.xrePath == None:
print "ERROR: unable to find xulrunner path for %s, please specify with --xre-path" % (os.name)
print("ERROR: unable to find xulrunner path for %s, please specify with --xre-path" % (os.name))
sys.exit(1)
paths.append("bin")
paths.append(os.path.join("..", "bin"))
@@ -169,7 +169,7 @@ class B2GRemoteReftest(RefTest):
options.utilityPath = self.findPath(paths, xpcshell)
if options.utilityPath == None:
print "ERROR: unable to find utility path for %s, please specify with --utility-path" % (os.name)
print("ERROR: unable to find utility path for %s, please specify with --utility-path" % (os.name))
sys.exit(1)
xpcshell = os.path.join(options.utilityPath, xpcshell)
@@ -269,7 +269,7 @@ class B2GRemoteReftest(RefTest):
try:
self._devicemanager.pushDir(profileDir, self.remoteProfile)
except DMError:
print "Automation Error: Unable to copy profile to device."
print("Automation Error: Unable to copy profile to device.")
raise
# Copy the extensions to the B2G bundles dir.
@@ -282,7 +282,7 @@ class B2GRemoteReftest(RefTest):
try:
self._devicemanager.pushDir(extensionDir, self.bundlesDir)
except DMError:
print "Automation Error: Unable to copy extensions to device."
print("Automation Error: Unable to copy extensions to device.")
raise
self.updateProfilesIni(self.remoteProfile)
@@ -296,7 +296,7 @@ class B2GRemoteReftest(RefTest):
try:
self._devicemanager.pushDir(profileDir, options.remoteProfile)
except DMError:
print "Automation Error: Failed to copy extra files to device"
print("Automation Error: Failed to copy extra files to device")
raise
def environment(self, **kwargs):
@@ -375,7 +375,7 @@ def run_test_harness(parser, options):
width = int(parts[0].split(':')[1])
height = int(parts[1].split(':')[1])
if (width < 1366 or height < 1050):
print "ERROR: Invalid screen resolution %sx%s, please adjust to 1366x1050 or higher" % (width, height)
print("ERROR: Invalid screen resolution %sx%s, please adjust to 1366x1050 or higher" % (width, height))
return 1
auto.setProduct("b2g")
@@ -406,7 +406,7 @@ def run_test_harness(parser, options):
retVal = reftest.runTests(options.tests, options)
except:
print "Automation Error: Exception caught while running tests"
print("Automation Error: Exception caught while running tests")
traceback.print_exc()
reftest.stopWebServer(options)
try:
+14 -14
View File
@@ -42,12 +42,12 @@ def printTable(f, t):
i = f
while i <= t:
c = array[i]
print "0x%04x," % c,
print("0x%04x," % c, end=' ')
i = i + 1
if not i % 8:
print "\n\t",
print("\n\t", end=' ')
print '''/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
print('''/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -86,7 +86,7 @@ print '''/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset:
* ***** END LICENSE BLOCK ***** */
/* THIS FILE IS GENERATED BY generate_table.py. DON'T EDIT THIS */
'''
''')
p = re.compile('([0-9A-F]{4,5})(?:\.\.([0-9A-F]{4,5}))?[=\>]([0-9A-F]{4,5})?')
G_FROM = 1
@@ -224,10 +224,10 @@ while i < maxmapping:
continue
if needTerm:
print "};\n"
print("};\n")
globalTable.append("gNormalizeTable%04x" % i)
print "static const unsigned short gNormalizeTable%04x[] = {\n\t" % i,
print "/* U+%04x */\n\t" % i,
print("static const unsigned short gNormalizeTable%04x[] = {\n\t" % i, end=' ')
print("/* U+%04x */\n\t" % i, end=' ')
needTerm = True
# Decomposition does not case-fold, so we want to compensate by
# performing a lookup here. Because decomposition chains can be
@@ -239,20 +239,20 @@ while i < maxmapping:
if c >= 0x41 and c <= 0x5a:
raise Exception('got an uppercase character somehow: %x => %x'
% (i, c))
print "0x%04x," % c,
print("0x%04x," % c, end=' ')
i = i + 1
if not i % 8:
print "\n\t",
print("\n\t", end=' ')
print "};\n\nstatic const unsigned short* gNormalizeTable[] = {",
print("};\n\nstatic const unsigned short* gNormalizeTable[] = {", end=' ')
i = 0
while i < (maxmapping / sizePerTable):
if not i % 4:
print "\n\t",
print globalTable[i] + ",",
print("\n\t", end=' ')
print(globalTable[i] + ",", end=' ')
i += 1
print '''
print('''
};
unsigned int normalize_character(const unsigned int c)
@@ -261,4 +261,4 @@ unsigned int normalize_character(const unsigned int c)
return c;
return gNormalizeTable[c >> 6][c & 0x3f];
}
'''
''')
+7 -7
View File
@@ -36,8 +36,8 @@ def match_block(command, parsed, start):
depth -= 1
end = end + 1
if end == len(parsed):
print('error: eof when trying to match block statement: %s'
% parsed[start])
print(('error: eof when trying to match block statement: %s'
% parsed[start]))
return end
@@ -67,8 +67,8 @@ def parse_if(parsed, start):
depth -= 1
end = end + 1
if end == len(parsed):
print('error: eof when trying to match if statement: %s'
% parsed[start])
print(('error: eof when trying to match if statement: %s'
% parsed[start]))
condition.append(parsed[start:end])
conditions.append(condition)
return end, conditions
@@ -125,10 +125,10 @@ def evaluate(variables, cache_variables, parsed):
elif command == 'include':
if arguments:
try:
print('including: %s' % arguments[0])
print(('including: %s' % arguments[0]))
sources.extend(parse(variables, cache_variables, arguments[0]))
except IOError:
print('warning: could not include: %s' % arguments[0])
print(('warning: could not include: %s' % arguments[0]))
elif command == 'list':
try:
action = arguments[0]
@@ -193,7 +193,7 @@ def evaluate(variables, cache_variables, parsed):
for source in arguments[1:]:
sources.extend(source.split(' '))
elif command == 'MOZDEBUG':
print('>>>> MOZDEBUG: %s' % ' '.join(arguments))
print(('>>>> MOZDEBUG: %s' % ' '.join(arguments)))
i += 1
return True, sources
+1 -1
View File
@@ -97,7 +97,7 @@ if __name__ == '__main__':
('x86_64', 'win', 'mingw64', False),
]
for cpu, system, arch, generate_sources in platforms:
print('Running CMake for %s (%s)' % (cpu, system))
print(('Running CMake for %s (%s)' % (cpu, system)))
variables = shared_variables.copy()
variables['AOM_TARGET_CPU'] = cpu
+2 -2
View File
@@ -457,10 +457,10 @@ def HandleFiles(variables):
for i in range(len(dirs)):
formatters = "%s formatter.format(better, %d);" % (formatters, i+1)
print FillForm(page_template, vars())
print(FillForm(page_template, vars()))
return
if len(sys.argv) < 3:
print HandleFiles.__doc__
print(HandleFiles.__doc__)
else:
HandleFiles(sys.argv)
@@ -108,7 +108,7 @@ def main(bits=15, first_token=1):
for q in range(1, 256):
parray = get_quantized_spareto(q / 256., beta, bits, first_token)
assert parray.sum() == 2**bits
print '{', ', '.join('%d' % i for i in parray), '},'
print('{', ', '.join('%d' % i for i in parray), '},')
if __name__ == '__main__':
@@ -15,7 +15,7 @@ def pinv_solution(A, mv, B):
new_A = np.concatenate((A, mv), axis=1)
new_A_inv = np.linalg.pinv(new_A)
new_x = np.matmul(new_A_inv, B)
print("pinv solution:", new_x[0][0], new_x[1][0])
print(("pinv solution:", new_x[0][0], new_x[1][0]))
return (new_x[0][0], new_x[1][0])
# Model A only.
@@ -160,7 +160,7 @@ def print_solutions(file_path):
all_zeros = not A.any()
if all_zeros:
continue
print("update type:", update[0][0])
print(("update type:", update[0][0]))
x_ls = lstsq_solution(A, B)
x_a = minimize_percentage_error_model_a(A, B)
x_b = minimize_percentage_error_model_b(A, mv, B)
@@ -175,10 +175,10 @@ def print_solutions(file_path):
baseline_squared_error_b = average_squared_error_model_b(A, mv, B, [1, 1])[0]
print("model,\tframe_coeff,\tmv_coeff,\terror,\tbaseline_error")
print("Model A %_error,\t" + str(x_a) + ",\t" + str(0) + ",\t" + str(percent_error_a) + ",\t" + str(baseline_percent_error_a))
print("Model A sq_error,\t" + str(x_a) + ",\t" + str(0) + ",\t" + str(squared_error_a) + ",\t" + str(baseline_squared_error_a))
print("Model B %_error,\t" + str(x_b[0]) + ",\t" + str(x_b[1]) + ",\t" + str(percent_error_b) + ",\t" + str(baseline_percent_error_b))
print("Model B sq_error,\t" + str(x_b[0]) + ",\t" + str(x_b[1]) + ",\t" + str(squared_error_b) + ",\t" + str(baseline_squared_error_b))
print(("Model A %_error,\t" + str(x_a) + ",\t" + str(0) + ",\t" + str(percent_error_a) + ",\t" + str(baseline_percent_error_a)))
print(("Model A sq_error,\t" + str(x_a) + ",\t" + str(0) + ",\t" + str(squared_error_a) + ",\t" + str(baseline_squared_error_a)))
print(("Model B %_error,\t" + str(x_b[0]) + ",\t" + str(x_b[1]) + ",\t" + str(percent_error_b) + ",\t" + str(baseline_percent_error_b)))
print(("Model B sq_error,\t" + str(x_b[0]) + ",\t" + str(x_b[1]) + ",\t" + str(squared_error_b) + ",\t" + str(baseline_squared_error_b)))
print()
if __name__ == "__main__":
+1 -1
View File
@@ -71,7 +71,7 @@ def main():
break
if out_hunks:
print FormatDiffHunks(out_hunks)
print(FormatDiffHunks(out_hunks))
sys.exit(1)
if __name__ == "__main__":
+6 -6
View File
@@ -71,11 +71,11 @@ def main(argv=None):
# process options
for o, _ in opts:
if o in ("-h", "--help"):
print __doc__
print(__doc__)
sys.exit(0)
if args and len(args) > 1:
print __doc__
print(__doc__)
sys.exit(0)
# Find the fully qualified path to the root of the tree
@@ -129,8 +129,8 @@ def main(argv=None):
continue
warning_line_num = int(fields[1])
if warning_line_num in affected_lines:
print "%s:%d:%s"%(filename, warning_line_num,
":".join(fields[2:]))
print("%s:%d:%s"%(filename, warning_line_num,
":".join(fields[2:])))
lint_failed = True
# Set exit code if any relevant lint errors seen
@@ -138,8 +138,8 @@ def main(argv=None):
return 1
except Usage, err:
print >>sys.stderr, err
print >>sys.stderr, "for help use --help"
print(err, file=sys.stderr)
print("for help use --help", file=sys.stderr)
return 2
if __name__ == "__main__":
@@ -49,7 +49,7 @@ def GenerateConformanceCorpus(args):
test_dir = os.path.join(args.output, test_id)
os.makedirs(test_dir, 0o755, exist_ok=True)
print('Generating %s' % (test_id, ))
print(('Generating %s' % (test_id, )))
input_file = os.path.join(test_dir, 'input.jxl')
shutil.copy(jxl, input_file)
@@ -74,7 +74,7 @@ def EvalPnorm(build_dir, corpus_dir, codec):
if len(sys.argv) != 3:
print("usage: ", sys.argv[0], "build-dir corpus-dir")
print(("usage: ", sys.argv[0], "build-dir corpus-dir"))
exit(1)
build_dir = sys.argv[1]
@@ -82,7 +82,7 @@ corpus_dir = sys.argv[2]
jpeg_pnorm = EvalPnorm(build_dir, corpus_dir, "jpeg:q90")
print("Libjpeg pnorm: %.8f" % jpeg_pnorm)
print(("Libjpeg pnorm: %.8f" % jpeg_pnorm))
for scale_type in ["YCbCr", "XYB"]:
scale = ReadGlobalScale(scale_type)
@@ -91,8 +91,8 @@ for scale_type in ["YCbCr", "XYB"]:
for i in range(10):
jpegli_pnorm = EvalPnorm(build_dir, corpus_dir, CodecName(scale_type))
rel_error = abs(jpegli_pnorm / jpeg_pnorm - 1)
print("[%-5s] scale: %.8f pnorm: %.8f error: %.8f" %
(scale_type, scale, jpegli_pnorm, rel_error))
print(("[%-5s] scale: %.8f pnorm: %.8f error: %.8f" %
(scale_type, scale, jpegli_pnorm, rel_error)))
if rel_error < best_rel_error:
best_rel_error = rel_error
best_scale = scale
@@ -177,7 +177,7 @@ def MaybeUpdateFile(args, filename, new_text):
return True
if args.update:
print('Updating %s' % filename)
print(('Updating %s' % filename))
with open(filepath, 'w') as f:
f.write(new_text)
return True
+1 -1
View File
@@ -64,7 +64,7 @@ def generate_sources_mozbuild(path):
if __name__ == '__main__':
if len(sys.argv) != 2:
print("Usage: %s /path/to/opus" % (sys.argv[0]))
print(("Usage: %s /path/to/opus" % (sys.argv[0])))
sys.exit(1)
generate_sources_mozbuild(sys.argv[1])
+1 -1
View File
@@ -26,4 +26,4 @@ except:
for f in SOURCES+UNIFIED_SOURCES:
if not f.startswith('binding/'):
print f
print(f)
@@ -38,7 +38,7 @@ def get_file_sha(filename):
buf = file.read(HASH_CHUNK)
return sha_hash.hexdigest()
except IOError:
print("Error reading " + filename)
print(("Error reading " + filename))
# Downloads a file from a url, and then checks the sha against the passed
# in sha
@@ -109,10 +109,10 @@ for filename, sha in zip(file_names, file_shas):
path = os.path.join(local_resource_path, filename)
if os.path.isfile(path) \
and get_file_sha(path) == sha:
print(path + ' exists, skipping')
print((path + ' exists, skipping'))
continue
for retry in range(0, ftp_retries):
print("Downloading " + path)
print(("Downloading " + path))
if not download_and_check_sha(url, filename, sha):
print("Sha does not match, retrying...")
else:
@@ -22,7 +22,7 @@ import sys
def main():
if len(sys.argv) != 3:
print "Expects a file to write json to!"
print("Expects a file to write json to!")
exit(1)
try:
@@ -30,7 +30,7 @@ def main():
getopt.getopt(sys.argv[1:], \
'o:', ['output-json='])
except getopt.GetOptError:
print 'scrape_gtest_log.py -o <output_json>'
print('scrape_gtest_log.py -o <output_json>')
sys.exit(2)
output_json = ''
@@ -41,10 +41,10 @@ def main():
blob = sys.stdin.read()
json_string = '[' + ','.join('{' + x + '}' for x in
re.findall(r'{([^}]*.?)}', blob)) + ']'
print blob
print(blob)
output = json.dumps(json.loads(json_string), indent=4, sort_keys=True)
print output
print(output)
path = os.path.dirname(output_json)
if path and not os.path.exists(path):
@@ -66,16 +66,16 @@ if __name__ == "__main__":
else:
frames.append((idx, img))
if len(frames) == 0:
print("No frames in directory: " + args.frame_path)
print(("No frames in directory: " + args.frame_path))
sys.exit()
print("----------------------Y4M Info----------------------")
print("width: %d" % frames[0][1].width)
print("height: %d" % frames[0][1].height)
print("#frame: %d" % len(frames))
print("frame rate: %s" % args.frame_rate)
print("interlacing: %s" % args.interlacing)
print("pixel ratio: %s" % args.pix_ratio)
print("color space: %s" % args.color_space)
print(("width: %d" % frames[0][1].width))
print(("height: %d" % frames[0][1].height))
print(("#frame: %d" % len(frames)))
print(("frame rate: %s" % args.frame_rate))
print(("interlacing: %s" % args.interlacing))
print(("pixel ratio: %s" % args.pix_ratio))
print(("color space: %s" % args.color_space))
print("----------------------------------------------------")
print("Generating ...")
Loaded 100 of 442 files, more files were not shown because too many files have changed in this diff. Show more