Skip to content

Commit 50e48d0

Browse files
authored
Be precise when processing exclude_dirs for ports. NFC (#19653)
The previously would check the entire path, including all path elements leading up to the ports directory. Fixes: #19644
1 parent c729eba commit 50e48d0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tools/ports/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,10 @@ def build_port(src_dir, output_path, port_name, includes=[], flags=[], cxxflags=
135135
srcs = [os.path.join(src_dir, s) for s in srcs]
136136
else:
137137
srcs = []
138-
for root, _, files in os.walk(src_dir, topdown=False):
139-
if any((excluded in root) for excluded in exclude_dirs):
140-
continue
138+
for root, dirs, files in os.walk(src_dir):
139+
for ex in exclude_dirs:
140+
if ex in dirs:
141+
dirs.remove(ex)
141142
for f in files:
142143
ext = shared.suffix(f)
143144
if ext in ('.c', '.cpp') and not any((excluded in f) for excluded in exclude_files):

0 commit comments

Comments
 (0)