@@ -341,7 +341,7 @@ def need_update(self, target, dependencies):
341
341
342
342
return False
343
343
344
- def scan_resources (self , path ):
344
+ def scan_resources (self , path , exclude_paths = None ):
345
345
labels = self .get_labels ()
346
346
resources = Resources (path )
347
347
self .has_config = False
@@ -359,12 +359,23 @@ def scan_resources(self, path):
359
359
for root , dirs , files in walk (path ):
360
360
# Remove ignored directories
361
361
for d in copy (dirs ):
362
+ dir_path = join (root , d )
363
+
362
364
if d == '.hg' :
363
- dir_path = join (root , d )
364
365
resources .repo_dirs .append (dir_path )
365
366
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
368
379
(d .startswith ('TARGET_' ) and d [7 :] not in labels ['TARGET' ]) or
369
380
(d .startswith ('TOOLCHAIN_' ) and d [10 :] not in labels ['TOOLCHAIN' ]) or
370
381
(d == 'TESTS' )):
0 commit comments