From 0e64c959be762c9e8a4a3b5a46a3674e262306fd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 10 Dec 2023 17:35:18 +1100 Subject: [PATCH] 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. --- build_files/cmake/project_source_info.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/build_files/cmake/project_source_info.py b/build_files/cmake/project_source_info.py index 45f80b18c7e..6ab9eee08d8 100644 --- a/build_files/cmake/project_source_info.py +++ b/build_files/cmake/project_source_info.py @@ -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