@@ -443,9 +443,8 @@ def scan_resources(self, path, exclude_paths=None, base_path=None):
443
443
itself is generated.
444
444
"""
445
445
for root , dirs , files in walk (path , followlinks = True ):
446
- # Remove ignored directories
447
446
# Check if folder contains .mbedignore
448
- if ".mbedignore" in files :
447
+ if ".mbedignore" in files :
449
448
with open (join (root ,".mbedignore" ), "r" ) as f :
450
449
lines = f .readlines ()
451
450
lines = [l .strip () for l in lines ] # Strip whitespaces
@@ -454,8 +453,13 @@ def scan_resources(self, path, exclude_paths=None, base_path=None):
454
453
# Append root path to glob patterns and append patterns to ignore_patterns
455
454
self .ignore_patterns .extend ([join (root ,line .strip ()) for line in lines ])
456
455
456
+ # Skip the whole folder if ignored, e.g. .mbedignore containing '*'
457
+ if self .is_ignored (join (root ,"" )):
458
+ continue
459
+
457
460
for d in copy (dirs ):
458
461
dir_path = join (root , d )
462
+ # Add internal repo folders/files. This is needed for exporters
459
463
if d == '.hg' :
460
464
resources .repo_dirs .append (dir_path )
461
465
resources .repo_files .extend (self .scan_repository (dir_path ))
@@ -469,9 +473,10 @@ def scan_resources(self, path, exclude_paths=None, base_path=None):
469
473
self .is_ignored (join (dir_path ,"" )) or
470
474
# Ignore TESTS dir
471
475
(d == 'TESTS' )):
472
- dirs .remove (d )
476
+ dirs .remove (d )
473
477
elif d .startswith ('FEATURE_' ):
474
- # Recursively scan features but ignore them in the current scan. These are dynamically added by the config system if the conditions are matched
478
+ # Recursively scan features but ignore them in the current scan.
479
+ # These are dynamically added by the config system if the conditions are matched
475
480
resources .features [d [8 :]] = self .scan_resources (dir_path , base_path = base_path )
476
481
dirs .remove (d )
477
482
elif exclude_paths :
0 commit comments