fab.steps.find_source_files#
Gather files from a source folder.
Functions
|
Find the files in the source folder, with filtering. |
Classes
|
A path filter which excludes matching paths, this convenience class improves config readability. |
|
A path filter which includes matching paths, this convenience class improves config readability. |
- class fab.steps.find_source_files.Include(*filter_strings)#
A path filter which includes matching paths, this convenience class improves config readability.
- Parameters:
filter_strings (
str) – One or more strings to be used as pattern matches.
- class fab.steps.find_source_files.Exclude(*filter_strings)#
A path filter which excludes matching paths, this convenience class improves config readability.
- Parameters:
filter_strings (
str) – One or more strings to be used as pattern matches.
- fab.steps.find_source_files.find_source_files(config, source_root=None, output_collection=ArtefactSet.INITIAL_SOURCE_FILES, path_filters=None)#
Find the files in the source folder, with filtering.
Files can be included or excluded with simple pattern matching. Every file is included by default, unless the filters say otherwise.
Path filters are expected to be provided by the user in an ordered collection. The two convenience subclasses,
IncludeandExclude, improve readability.This function will use the longest match to determine if a file is to be excluded or included (in case of a tie the last matching filter will apply). For example:
path_filters = [ Exclude('some_folder'), Include('some_folder/my_file.F90'), ]
In the above example, swapping the order would not affect that
my_file.F90will be included. But if the filters have the same length:path_filters = [ Exclude('some_folder'), Include('my_file.F90'), ]
Then the last matching filter applies, in the order specified above this means the file would be included. If the order of
ExcludeandIncludeis swapped, the file would be excluded.A path matches a filter string simply if it contains it, so the path
my_folder/my_file.F90would match filtersmy_folder,my_fileander/my.- Parameters:
config (
BuildConfig) – Thefab.build_config.BuildConfigobject where we can read settings such as the project workspace folder or the multiprocessing flag.source_root (
Path|None) – Optional path to source folder, with a sensible default. (default:None)output_collection (
ArtefactSet|str) – Name of artefact collection to create, with a sensible default. (default:<ArtefactSet.INITIAL_SOURCE_FILES: 1>)path_filters (
Iterable[_PathFilter] |None) – Iterable of Include and/or Exclude objects, to be processed in order. (default:None)name – Human friendly name for logger output, with sensible default.
- Return type: