Skip to content

Commit f77d9e7

Browse files
committed
Merge pull request #95 from screamerbg/master
Build system exclude folders containing .buildignore file
2 parents 7634adb + faa9ce7 commit f77d9e7

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

tools/toolchains/__init__.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -366,23 +366,21 @@ def scan_resources(self, path, exclude_paths=None):
366366
if d == '.hg':
367367
resources.repo_dirs.append(dir_path)
368368
resources.repo_files.extend(self.scan_repository(dir_path))
369-
370-
should_exclude_path = False
369+
370+
if ((d.startswith('.') or d in self.legacy_ignore_dirs) or
371+
(d.startswith('TARGET_') and d[7:] not in labels['TARGET']) or
372+
(d.startswith('TOOLCHAIN_') and d[10:] not in labels['TOOLCHAIN']) or
373+
(d == 'TESTS') or
374+
exists(join(dir_path, '.buildignore'))):
375+
dirs.remove(d)
371376

372377
if exclude_paths:
373378
for exclude_path in exclude_paths:
374379
rel_path = relpath(dir_path, exclude_path)
375380
if not (rel_path.startswith('..')):
376-
should_exclude_path = True
381+
dirs.remove(d)
377382
break
378383

379-
if ((should_exclude_path) or
380-
(d.startswith('.') or d in self.legacy_ignore_dirs) or
381-
(d.startswith('TARGET_') and d[7:] not in labels['TARGET']) or
382-
(d.startswith('TOOLCHAIN_') and d[10:] not in labels['TOOLCHAIN']) or
383-
(d == 'TESTS')):
384-
dirs.remove(d)
385-
386384
# Add root to include paths
387385
resources.inc_dirs.append(root)
388386

0 commit comments

Comments
 (0)