@@ -210,7 +210,7 @@ def __str__(self):
210
210
211
211
class mbedToolchain :
212
212
VERBOSE = True
213
- ignorepatterns = []
213
+ ignore_ptrs = []
214
214
215
215
CORTEX_SYMBOLS = {
216
216
"Cortex-M0" : ["__CORTEX_M0" , "ARM_MATH_CM0" , "__CMSIS_RTOS" , "__MBED_CMSIS_RTOS_CM" ],
@@ -407,7 +407,7 @@ def need_update(self, target, dependencies):
407
407
return False
408
408
409
409
def is_ignored (self , file_path ):
410
- for pattern in self .ignorepatterns :
410
+ for pattern in self .ignore_ptrs :
411
411
if fnmatch .fnmatch (file_path , pattern ):
412
412
return True
413
413
return False
@@ -441,33 +441,30 @@ def scan_resources(self, path, exclude_paths=None, base_path=None):
441
441
lines = [l .strip () for l in lines ] # Strip whitespaces
442
442
lines = [l for l in lines if l != "" ] # Strip empty lines
443
443
lines = [l for l in lines if not re .match ("^#" ,l )] # Strip comment lines
444
- # Append root path to glob patterns
445
- # and append patterns to ignorepatterns
446
- self .ignorepatterns .extend ([join (root ,line .strip ()) for line in lines ])
444
+ # Append root path to glob patterns and append patterns to ignore_ptrs
445
+ self .ignore_ptrs .extend ([join (root ,line .strip ()) for line in lines ])
447
446
448
447
for d in copy (dirs ):
449
448
dir_path = join (root , d )
450
449
if d == '.hg' :
451
450
resources .repo_dirs .append (dir_path )
452
451
resources .repo_files .extend (self .scan_repository (dir_path ))
453
-
452
+
454
453
if ((d .startswith ('.' ) or d in self .legacy_ignore_dirs ) or
454
+ # Ignore targets that do not match the TARGET in extra_labels list
455
455
(d .startswith ('TARGET_' ) and d [7 :] not in labels ['TARGET' ]) or
456
+ # Ignore toolchain that do not match the current TOOLCHAIN
456
457
(d .startswith ('TOOLCHAIN_' ) and d [10 :] not in labels ['TOOLCHAIN' ]) or
458
+ # Ignore .mbedignore files
459
+ self .is_ignored (join (dir_path ,"" )) or
460
+ # Ignore TESTS dir
457
461
(d == 'TESTS' )):
458
462
dirs .remove (d )
459
-
460
- if ( d . startswith ( 'FEATURE_' )):
463
+ elif d . startswith ( 'FEATURE_' ):
464
+ # Recursively scan features but ignore them in the current scan. These are dynamically added by the config system if the conditions are matched
461
465
resources .features [d [8 :]] = self .scan_resources (dir_path , base_path = base_path )
462
466
dirs .remove (d )
463
-
464
- # Remove dirs that already match the ignorepatterns
465
- # to avoid travelling into them and to prevent them
466
- # on appearing in include path.
467
- if self .is_ignored (join (dir_path ,"" )):
468
- dirs .remove (d )
469
-
470
- if exclude_paths :
467
+ elif exclude_paths :
471
468
for exclude_path in exclude_paths :
472
469
rel_path = relpath (dir_path , exclude_path )
473
470
if not (rel_path .startswith ('..' )):
0 commit comments