Skip to content

Commit

Permalink
Merge pull request #58 from bridadan/allow-toolchain-exclude-path
Browse files Browse the repository at this point in the history
Allow toolchains to exclude a path when scan for resources
  • Loading branch information
bogdanm committed Apr 25, 2016
2 parents 0a14cc4 + bbc6e2a commit 22e1e98
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions tools/toolchains/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def need_update(self, target, dependencies):

return False

def scan_resources(self, path):
def scan_resources(self, path, exclude_paths=None):
labels = self.get_labels()
resources = Resources(path)
self.has_config = False
Expand All @@ -359,12 +359,23 @@ def scan_resources(self, path):
for root, dirs, files in walk(path):
# Remove ignored directories
for d in copy(dirs):
dir_path = join(root, d)

if d == '.hg':
dir_path = join(root, d)
resources.repo_dirs.append(dir_path)
resources.repo_files.extend(self.scan_repository(dir_path))

if ((d.startswith('.') or d in self.legacy_ignore_dirs) or

should_exclude_path = False

if exclude_paths:
for exclude_path in exclude_paths:
rel_path = relpath(dir_path, exclude_path)
if not (rel_path.startswith('..')):
should_exclude_path = True
break

if ((should_exclude_path) or
(d.startswith('.') or d in self.legacy_ignore_dirs) or
(d.startswith('TARGET_') and d[7:] not in labels['TARGET']) or
(d.startswith('TOOLCHAIN_') and d[10:] not in labels['TOOLCHAIN']) or
(d == 'TESTS')):
Expand Down

0 comments on commit 22e1e98

Please sign in to comment.