From 5087113387966cd0a6a6544d4b45a59ff48cd61a Mon Sep 17 00:00:00 2001 From: Bob Long Date: Wed, 22 May 2024 23:49:22 -0500 Subject: [PATCH] Tools: fix handling of include files for Periph This fix scans all the include files in a hwdef, not just one on the first line. --- Tools/ardupilotwaf/boards.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index b25591523afaf..61917ea065912 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -609,15 +609,13 @@ def get_ap_periph_boards(): list_ap.append(d) continue # process any include lines: - m = re.match(r"include\s+([^\s]*)", content) - if m is None: - continue - include_path = os.path.join(os.path.dirname(hwdef), m.group(1)) - with open(include_path, "r") as g: - content = g.read() - if 'AP_PERIPH' in content: - list_ap.append(d) - continue + for m in re.finditer(r"^include\s+([^\s]*)", content, re.MULTILINE): + include_path = os.path.join(os.path.dirname(hwdef), m.group(1)) + with open(include_path, "r") as g: + content = g.read() + if 'AP_PERIPH' in content: + list_ap.append(d) + break list_ap = list(set(list_ap)) return list_ap