Fix "project_source_info" use with clang

Simple string replacement failed when one compiler was the exact
prefix of another (`clang` & `clang++` in this case),
resolve by performing string replacement on the list items.
This commit is contained in:
Campbell Barton 2023-12-10 17:35:18 +11:00
parent f02ebe7e2b
commit 0e64c959be

@ -150,11 +150,12 @@ def build_info(
print("parsing make log ...")
for line in makelog:
args: Union[str, List[str]] = line.split()
if not any([(c in args) for c in compilers]):
args_orig: Union[str, List[str]] = line.split()
args = [fake_compiler if c in compilers else c for c in args_orig]
if args == args_orig:
# No compilers in the command, skip.
continue
del args_orig
# join args incase they are not.
args = ' '.join(args)
@ -162,8 +163,6 @@ def build_info(
args = args.replace(" -D ", " -D")
args = args.replace(" -I ", " -I")
for c in compilers:
args = args.replace(c, fake_compiler)
args = shlex.split(args)
# end