Commit eaec33fb authored by Raul Tambre's avatar Raul Tambre Committed by Commit Bot

//base: Convert print statements to Python 3 style

Ran "2to3 -w -n -f print ./base" and manually added imports.
There are no intended behaviour changes.

Bug: 941669
Change-Id: If5eb9217385a6d9a7807a4ca03116e1db9999695
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1559958
Commit-Queue: Raul Tambre <raul@tambre.ee>
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Auto-Submit: Raul Tambre <raul@tambre.ee>
Cr-Commit-Position: refs/heads/master@{#649237}
parent fe27ac42
......@@ -6,6 +6,8 @@
"""Extracts native methods from a Java file and generates the JNI bindings.
If you change this, please run and update the tests."""
from __future__ import print_function
import base64
import collections
import errno
......@@ -1534,13 +1536,13 @@ def GenerateJNIHeader(input_file, output_file, options):
input_file, options)
content = jni_from_java_source.GetContent()
except ParseError, e:
print e
print(e)
sys.exit(1)
if output_file:
with build_utils.AtomicOutput(output_file) as f:
f.write(content)
else:
print content
print(content)
def GetScriptName():
......@@ -1613,7 +1615,7 @@ See SampleForTests.java for more details.
input_file = options.input_file
else:
option_parser.print_help()
print '\nError: Must specify --jar_file or --input_file.'
print('\nError: Must specify --jar_file or --input_file.')
return 1
output_file = None
if options.output_dir:
......
......@@ -11,6 +11,8 @@ code generator and ensures the output matches a golden
file.
"""
from __future__ import print_function
import difflib
import inspect
import optparse
......@@ -133,16 +135,16 @@ class BaseTest(unittest.TestCase):
stripped_generated = FilterText(generated_text)
if stripped_golden == stripped_generated:
return True
print self.id()
print(self.id())
for line in difflib.context_diff(stripped_golden, stripped_generated):
print line
print '\n\nGenerated'
print '=' * 80
print generated_text
print '=' * 80
print 'Run with:'
print 'REBASELINE=1', sys.argv[0]
print 'to regenerate the data files.'
print(line)
print('\n\nGenerated')
print('=' * 80)
print(generated_text)
print('=' * 80)
print('Run with:')
print('REBASELINE=1', sys.argv[0])
print('to regenerate the data files.')
def AssertGoldenTextEquals(self, generated_text, suffix='', golden_file=None):
"""Compares generated text with the corresponding golden_file
......
......@@ -58,6 +58,8 @@ These exceptions are:
instead of by another class using that object.
"""
from __future__ import print_function
import argparse
import sys
import string
......
......@@ -58,6 +58,8 @@ Note: MODE_SPECIFIC_STRINGS cannot be specified if STRING_IDS is not specified.
# and IDS_L10N_OFFSET_* for the language we are interested in.
#
from __future__ import print_function
import argparse
import exceptions
import glob
......@@ -318,8 +320,9 @@ Missing input files:
Extra input files:
{}
'''
print error.format('\n'.join(self.expected_xtb_input_files),
'\n'.join(all_xtb_files), '\n'.join(missing), '\n'.join(extra))
print(error.format('\n'.join(self.expected_xtb_input_files),
'\n'.join(all_xtb_files), '\n'.join(missing),
'\n'.join(extra)))
sys.exit(1)
return translated_strings
......@@ -391,12 +394,12 @@ Extra input files:
if missing_xtb_files:
missing_error = ("There were files that were found in the .grd file "
"'{}' but do not exist on disk:\n{}")
print missing_error.format(grd_file, '\n'.join(missing_xtb_files))
print(missing_error.format(grd_file, '\n'.join(missing_xtb_files)))
if extra_xtb_files:
extra_error = ("There were files that exist on disk but were not found "
"in the .grd file '{}':\n{}")
print extra_error.format(grd_file, '\n'.join(extra_xtb_files))
print(extra_error.format(grd_file, '\n'.join(extra_xtb_files)))
sys.exit(1)
return translated_strings
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment