Fix redirect-cc.py lint issues.

This commit is contained in:
Aleksey Khoroshilov
2021-12-08 14:44:06 +07:00
parent 26a7a26af4
commit 8113cf3538
+10 -8
View File
@@ -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