Skip to content

Commit 22e1e98

Browse files
committed
Merge pull request #58 from bridadan/allow-toolchain-exclude-path
Allow toolchains to exclude a path when scan for resources
2 parents 0a14cc4 + bbc6e2a commit 22e1e98

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

tools/toolchains/__init__.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def need_update(self, target, dependencies):
341341

342342
return False
343343

344-
def scan_resources(self, path):
344+
def scan_resources(self, path, exclude_paths=None):
345345
labels = self.get_labels()
346346
resources = Resources(path)
347347
self.has_config = False
@@ -359,12 +359,23 @@ def scan_resources(self, path):
359359
for root, dirs, files in walk(path):
360360
# Remove ignored directories
361361
for d in copy(dirs):
362+
dir_path = join(root, d)
363+
362364
if d == '.hg':
363-
dir_path = join(root, d)
364365
resources.repo_dirs.append(dir_path)
365366
resources.repo_files.extend(self.scan_repository(dir_path))
366-
367-
if ((d.startswith('.') or d in self.legacy_ignore_dirs) or
367+
368+
should_exclude_path = False
369+
370+
if exclude_paths:
371+
for exclude_path in exclude_paths:
372+
rel_path = relpath(dir_path, exclude_path)
373+
if not (rel_path.startswith('..')):
374+
should_exclude_path = True
375+
break
376+
377+
if ((should_exclude_path) or
378+
(d.startswith('.') or d in self.legacy_ignore_dirs) or
368379
(d.startswith('TARGET_') and d[7:] not in labels['TARGET']) or
369380
(d.startswith('TOOLCHAIN_') and d[10:] not in labels['TOOLCHAIN']) or
370381
(d == 'TESTS')):

0 commit comments

Comments
 (0)