Update check_formatting.py to work with python3

Change-Id: Iff3ba89f3b3e6fe0991e48482546084d1ba66ac5
This commit is contained in:
KongQun Yang 2021-05-02 20:30:36 -07:00
parent 6c8ad30217
commit 23953bf931
1 changed files with 4 additions and 3 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/python3
#
# Copyright 2017 Google Inc. All rights reserved.
#
@ -41,7 +41,7 @@ if __name__ == '__main__':
is_pre_commit_hook = len(sys.argv) == 1
if not is_pre_commit_hook:
output = subprocess.check_output(['git', 'log', '--pretty=full', '-1'])
if 'disable-clang-format' in output:
if b'disable-clang-format' in output:
sys.exit(0)
command = ['git', 'clang-format', '--style', 'Chromium']
@ -49,7 +49,8 @@ if __name__ == '__main__':
output = subprocess.check_output(command + ['--diff'])
if output not in [
'no modified files to format\n', 'clang-format did not modify any files\n'
b'no modified files to format\n',
b'clang-format did not modify any files\n'
]:
print(output)
print()