@@ -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