Skip to content

Commit 63072e0

Browse files
authored
refactor check tools install
1 parent bb6350e commit 63072e0

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

platform.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def install_tool(TOOL):
110110
if mcu == "esp32c2":
111111
self.packages["framework-arduino-c2-skeleton-lib"]["optional"] = False
112112

113-
mcu_toolchain_mapping = {
113+
MCU_TOOLCHAIN_MAPPING = {
114114
# Xtensa based and FSM toolchain
115115
("esp32", "esp32s2", "esp32s3"): {
116116
"toolchains": ["toolchain-xtensa-esp-elf"],
@@ -124,9 +124,8 @@ def install_tool(TOOL):
124124
"debug_tools": ["tool-riscv32-esp-elf-gdb"]
125125
}
126126
}
127-
128127
# Iterate through MCU mappings
129-
for supported_mcus, toolchain_data in mcu_toolchain_mapping.items():
128+
for supported_mcus, toolchain_data in MCU_TOOLCHAIN_MAPPING.items():
130129
if mcu in supported_mcus:
131130
# Set mandatory toolchains
132131
for toolchain in toolchain_data["toolchains"]:
@@ -155,10 +154,17 @@ def install_tool(TOOL):
155154
for package in COMMON_IDF_PACKAGES:
156155
self.packages[package]["optional"] = False
157156

158-
# Enable check tools only when "check_tool" is active
159-
for p in self.packages:
160-
if p in ("tool-cppcheck", "tool-clangtidy", "tool-pvs-studio"):
161-
self.packages[p]["optional"] = False if str(variables.get("check_tool")).strip("['']") in p else True
157+
CHECK_PACKAGES = [
158+
"tool-cppcheck",
159+
"tool-clangtidy",
160+
"tool-pvs-studio"
161+
]
162+
# Install check tool listed in pio entry "check_tool"
163+
if variables.get("check_tool") is not None:
164+
for package in CHECK_PACKAGES:
165+
for check_tool in variables.get("check_tool", ""):
166+
if check_tool in package:
167+
self.packages[package]["optional"] = False
162168

163169
if "buildfs" in targets:
164170
filesystem = variables.get("board_build.filesystem", "littlefs")

0 commit comments

Comments
 (0)