diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-04-09 18:33:36 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-04-09 18:33:36 +0000 |
commit | 358a43f9db317c0747c95737cf86362d1c8387b7 (patch) | |
tree | dab11076d5cc744b9d1e951c10a5d181092e7806 | |
parent | c8482417b6627decc4200b32bb7de125e0adead1 (diff) | |
parent | 0020f68936c101ebc86b9ee74d75bdb389f348d9 (diff) | |
download | repohooks-studio-master-dev.tar.gz |
Snap for 6379844 from 0020f68936c101ebc86b9ee74d75bdb389f348d9 to studio-4.1-releasestudio-4.1.1studio-4.1.0studio-master-dev
Change-Id: Ia1575d175dd03180d74b139a2f847829eed47846
-rwxr-xr-x | tools/google-java-format-diff.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/google-java-format-diff.py b/tools/google-java-format-diff.py index 4f2bd2d..b804f30 100755 --- a/tools/google-java-format-diff.py +++ b/tools/google-java-format-diff.py @@ -27,11 +27,13 @@ import difflib import os import platform import re +import six import string -import StringIO import subprocess import sys from distutils.spawn import find_executable +from io import StringIO +from six import StringIO def find_executable_portable(executable): if platform.system() == 'Windows': @@ -104,9 +106,9 @@ def main(): ['-lines', str(start_line) + ':' + str(end_line)]) # Reformat files containing changes in place. - for filename, lines in lines_by_file.iteritems(): + for filename, lines in six.iteritems(lines_by_file): if args.i and args.verbose: - print 'Formatting', filename + print('Formatting %s' % filename) command = [binary] # Windows does not support running bash scripts directly @@ -132,7 +134,7 @@ def main(): # Open in binary mode to prevent Python from messing with line endings. with open(filename, 'rb') as f: code = f.readlines() - formatted_code = StringIO.StringIO(stdout).readlines() + formatted_code = StringIO(stdout.decode('utf-8')).readlines() diff = difflib.unified_diff(code, formatted_code, filename, filename, '(before formatting)', '(after formatting)') |