From c9b71045f8d647031bf7ddc76dcb7386f7fa3e35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Cab=C3=A9?= Date: Mon, 21 Oct 2024 16:31:12 +0200 Subject: [PATCH] doc: extensions: boards: Better handle unknown/other vendors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Boards under a folder that doesn't directly match a vendor prefix incorrectly end up being categorized as "zephyr" since that's the only prefix that is eventually found when navigating up the folder hierarchy. This commits treats boards in the "others" and "native" folders as special cases and associates them to an "Unknown/Other" category. Signed-off-by: Benjamin Cabé --- doc/_scripts/gen_boards_catalog.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/_scripts/gen_boards_catalog.py b/doc/_scripts/gen_boards_catalog.py index 42e8c068606..859f37c9ece 100644 --- a/doc/_scripts/gen_boards_catalog.py +++ b/doc/_scripts/gen_boards_catalog.py @@ -80,9 +80,13 @@ def get_catalog(): for board in boards: # We could use board.vendor but it is often incorrect. Instead, deduce vendor from - # containing folder + # containing folder. There are a few exceptions, like the "native" and "others" folders + # which we know are not actual vendors so treat them as such. for folder in board.dir.parents: - if vnd_lookup.vnd2vendor.get(folder.name): + if folder.name in ["native", "others"]: + vendor = "others" + break + elif vnd_lookup.vnd2vendor.get(folder.name): vendor = folder.name break @@ -118,4 +122,8 @@ def get_catalog(): series = soc.series or "" socs_hierarchy.setdefault(family, {}).setdefault(series, []).append(soc.name) - return {"boards": board_catalog, "vendors": vnd_lookup.vnd2vendor, "socs": socs_hierarchy} + return { + "boards": board_catalog, + "vendors": {**vnd_lookup.vnd2vendor, "others": "Other/Unknown"}, + "socs": socs_hierarchy, + }