From 23953bf931792d04d8f266bb9081046c0a3a25e5 Mon Sep 17 00:00:00 2001 From: KongQun Yang Date: Sun, 2 May 2021 20:30:36 -0700 Subject: [PATCH] Update check_formatting.py to work with python3 Change-Id: Iff3ba89f3b3e6fe0991e48482546084d1ba66ac5 --- packager/tools/git/check_formatting.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packager/tools/git/check_formatting.py b/packager/tools/git/check_formatting.py index 55926a1f6c..5e29ac8074 100755 --- a/packager/tools/git/check_formatting.py +++ b/packager/tools/git/check_formatting.py @@ -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()