diff --git a/script/redirect-cc.py b/script/redirect-cc.py index c99fd4dd12a..db268dd3654 100755 --- a/script/redirect-cc.py +++ b/script/redirect-cc.py @@ -14,20 +14,22 @@ def main(): if 'CC_WRAPPER' in os.environ: args = [os.environ['CC_WRAPPER']] + args cc_retcode = subprocess.call(args) - # To check the redirected file timestamp, it should be marked as dependency for ninja. + # To check the redirected file timestamp, it should be marked as dependency + # for ninja. # Linux/MacOS gcc deps format includes this file properly. # Windows msvc deps format does not include it, so we do it manually here. if IS_WIN32 and cc_retcode == 0 and brave_path: - # This is a specially crafted string that ninja will look for to create deps. + # This is a specially crafted string that ninja will look for to create + # deps. sys.stderr.write('Note: including file: %s\n' % brave_path) return cc_retcode def append_root_src_include(args): - for arg in args: - if arg.startswith('-I') and arg.endswith('brave/chromium_src'): - args.append(arg + '/../../..') - return + for arg in args: + if arg.startswith('-I') and arg.endswith('brave/chromium_src'): + args.append(arg + '/../../..') + return def replace_cc_arg(args): @@ -37,11 +39,11 @@ def replace_cc_arg(args): index_c = args.index('/c') else: index_c = args.index('-c') - except Exception: + except ValueError: # no -c or /c so just skip return - if 0 == len(args) or index_c == len(args) - 1: + if len(args) == 0 or index_c == len(args) - 1: # Something wrong, we have -c but have no path in the next arg # Just then give all to cc as is return