Skip to content

Commit c75515c

Browse files
committed
ci(arduino_cli): avoid search on same base path
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 247ce64 commit c75515c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

CI/build/arduino-cli.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
stm32_url_base = "https://github.com/stm32duino/BoardManagerFiles/raw/main/"
3333
stm32_url = f"{stm32_url_base}package_stmicroelectronics_index.json"
3434
sketches_path_list = []
35+
search_path_list = []
3536
default_build_output_dir = tempdir / "build_arduinoCliOutput"
3637
build_output_dir = tempdir / f"build_arduinoCliOutput{build_id}"
3738
build_output_cache_dir = build_output_dir / "cache"
@@ -154,6 +155,7 @@ def check_config():
154155
global arduino_cli_version
155156
global arduino_cli_path
156157
global sketches_path_list
158+
global search_path_list
157159
global build_output_dir
158160
global root_output_dir
159161
global output_dir
@@ -257,6 +259,13 @@ def check_config():
257259
else:
258260
print("No user directory!")
259261
quit(1)
262+
# Fill search_path_list to avoid search on the same path
263+
sorted_spl = sorted(set(sketches_path_list))
264+
search_path_list = []
265+
while sorted_spl:
266+
p = sorted_spl.pop(0)
267+
if not any(root in p.parents for root in search_path_list):
268+
search_path_list.append(Path(p))
260269
else:
261270
print("No arduino-cli config!")
262271
quit(1)
@@ -430,7 +439,7 @@ def find_inos():
430439
# key: path, value: name
431440
if args.sketches:
432441
arg_sketch_pattern = re.compile(args.sketches, re.IGNORECASE)
433-
for spath in sketches_path_list:
442+
for spath in search_path_list:
434443
for spath_object in spath.glob("**/*.[ip][nd][oe]"):
435444
if args.sketches:
436445
if arg_sketch_pattern.search(str(spath_object)) is None:

0 commit comments

Comments
 (0)