summaryrefslogtreecommitdiff
path: root/tools/build_utils.py
diff options
context:
space:
mode:
authorhathach <[email protected]>2024-04-09 20:26:26 +0700
committerhathach <[email protected]>2024-04-09 22:04:43 +0700
commit2bce68a065aa873ffd738b5a90639b3b4b18d2c2 (patch)
treec1a2bfc42a3be56b4751969681005665dfaf90ad /tools/build_utils.py
parent75cf8e21a7e525eb24b7fd34fe5859cba331fcc2 (diff)
parent68a08e33d2a1a3b02a28c616bc825eb674700833 (diff)
Merge branch 'master' into dwc2-interrupts
Diffstat (limited to 'tools/build_utils.py')
-rw-r--r--tools/build_utils.py29
1 files changed, 13 insertions, 16 deletions
diff --git a/tools/build_utils.py b/tools/build_utils.py
index ec850e732..b66b64b97 100644
--- a/tools/build_utils.py
+++ b/tools/build_utils.py
@@ -30,13 +30,8 @@ def skip_example(example, board):
family_dir = board_dir.parent.parent
family = family_dir.name
- # family CMake
- family_mk = family_dir / "family.cmake"
-
# family.mk
- if not family_mk.exists():
- family_mk = family_dir / "family.mk"
-
+ family_mk = family_dir / "family.mk"
mk_contents = family_mk.read_text()
# Find the mcu, first in family mk then board mk
@@ -47,6 +42,7 @@ def skip_example(example, board):
mk_contents = board_mk.read_text()
+ mcu = "NONE"
for token in mk_contents.split():
if "CFG_TUSB_MCU=OPT_MCU_" in token:
# Strip " because cmake files has them.
@@ -68,18 +64,19 @@ def skip_example(example, board):
skip_file = ex_dir / "skip.txt"
only_file = ex_dir / "only.txt"
- if skip_file.exists() and only_file.exists():
- raise RuntimeError("Only have a skip or only file. Not both.")
- elif skip_file.exists():
+ if skip_file.exists():
skips = skip_file.read_text().split()
- return ("mcu:" + mcu in skips or
- "board:" + board in skips or
- "family:" + family in skips)
- elif only_file.exists():
+ if ("mcu:" + mcu in skips or
+ "board:" + board in skips or
+ "family:" + family in skips):
+ return True
+
+ if only_file.exists():
onlys = only_file.read_text().split()
- return not ("mcu:" + mcu in onlys or
- "board:" + board in onlys or
- "family:" + family in onlys)
+ if not ("mcu:" + mcu in onlys or
+ "board:" + board in onlys or
+ "family:" + family in onlys):
+ return True
return False