fab.dep_tree#
Classes and helper functions related to the dependency tree, as created by the analysis stage.
Functions
|
Extract the subtree required to build the target, from the full source tree of all analysed source files. |
|
Pull out files with the given extensions from a source tree. |
|
If any dep is missing from the tree, then it's unknown code and we won't be able to compile. |
Classes
|
An |
- class fab.dep_tree.AnalysedDependent(fpath, file_hash=None, symbol_defs=None, symbol_deps=None, file_deps=None)#
An
AnalysedFilewhich can depend on others, and be a dependency. Instances of this class are nodes in a source dependency tree.During parsing, the symbol definitions and dependencies are filled in. During dependency analysis, symbol dependencies are turned into file dependencies.
- Parameters:
file_hash (
int|None) – The hash of the source. If omitted, Fab will evaluate lazily. (default:None)symbol_defs (
Iterable[str] |None) – Set of symbol names defined by this source file. (default:None)symbol_deps (
Iterable[str] |None) – Set of symbol names used by this source file. Can include symbols in the same file. (default:None)file_deps (
Iterable[Path] |None) – Other files on which this source depends. Must not include itself. This attribute is calculated during symbol analysis, after everything has been parsed. (default:None)
- classmethod field_names()#
Defines the order in which we want fields to appear in str or repr strings.
Calling this helps to ensure any lazy attributes are evaluated before use, e.g when constructing a string representation of the instance, or generating a hash value.
- fab.dep_tree.extract_sub_tree(source_tree, root, verbose=False)#
Extract the subtree required to build the target, from the full source tree of all analysed source files.
- Parameters:
source_tree (
Dict[Path,AnalysedDependent]) – The source tree of analysed files.root (
Path) – The root of the dependency tree, this is the filename containing the Fortran program.verbose – Log missing dependencies. (default:
False)
- Return type:
- fab.dep_tree.filter_source_tree(source_tree, suffixes)#
Pull out files with the given extensions from a source tree.
Returns a list of
AnalysedDependent.- Parameters:
source_tree (
Dict[Path,AnalysedDependent]) – The source tree of analysed files.suffixes (
Iterable[str]) – The suffixes we want, including the dot.
- Return type:
- fab.dep_tree.validate_dependencies(source_tree)#
If any dep is missing from the tree, then it’s unknown code and we won’t be able to compile.
- Parameters:
source_tree – The source tree of analysed files.