@@ -430,6 +430,12 @@ def is_ignored(self, file_path):
430
430
return True
431
431
return False
432
432
433
+ # Create a Resources object from the path pointed to by *path* by either traversing a
434
+ # a directory structure, when *path* is a directory, or adding *path* to the resources,
435
+ # when *path* is a file.
436
+ # The parameter *base_path* is used to set the base_path attribute of the Resources
437
+ # object and the parameter *exclude_paths* is used by the directory traversal to
438
+ # exclude certain paths from the traversal.
433
439
def scan_resources (self , path , exclude_paths = None , base_path = None ):
434
440
resources = Resources (path )
435
441
if not base_path :
@@ -445,6 +451,9 @@ def scan_resources(self, path, exclude_paths=None, base_path=None):
445
451
self ._add_dir (path , resources , base_path , exclude_paths = exclude_paths )
446
452
return resources
447
453
454
+ # A helper function for scan_resources. _add_dir traverses *path* (assumed to be a
455
+ # directory) and heeds the ".mbedignore" files along the way. _add_dir calls _add_file
456
+ # on every file it considers adding to the resources object.
448
457
def _add_dir (self , path , resources , base_path , exclude_paths = None ):
449
458
""" os.walk(top[, topdown=True[, onerror=None[, followlinks=False]]])
450
459
When topdown is True, the caller can modify the dirnames list in-place
@@ -508,6 +517,8 @@ def _add_dir(self, path, resources, base_path, exclude_paths=None):
508
517
file_path = join (root , file )
509
518
self ._add_file (file_path , resources , base_path )
510
519
520
+ # A helper function for both scan_resources and _add_dir. _add_file adds one file
521
+ # (*file_path*) to the resources object based on the file type.
511
522
def _add_file (self , file_path , resources , base_path , exclude_paths = None ):
512
523
resources .file_basepath [file_path ] = base_path
513
524
0 commit comments