fmf_jinja.utils

Utility module.

fmf_jinja.utils._fmf_node_name(tree)

Equivalent of pathlib.PurePath.name for fmf.Tree.

Parameters:

tree (Tree) – fmf tree

Return type:

str

Returns:

the path-like name attribute

fmf_jinja.utils.get_fmf_files(tree, *, relative=True)

Get all fmf tree source files.

Parameters:
  • tree (Tree) – fmf tree

  • relative (bool) – whether to output the source files relative to the root

Return type:

Iterator[Path]

Returns:

all fmf source files including the .fmf folder files

fmf_jinja.utils.copy_fmf_tree(tree, output)

Copy a fmf tree with all its sources.

Parameters:
  • tree (Tree) – fmf tree

  • output (Path) – destination path

Return type:

None

fmf_jinja.utils.fmf_tree_walk(tree, *, top_down=True)

Equivalent of pathlib.Path.walk() for fmf.Tree.

Parameters:
  • tree (Tree) – fmf tree

  • top_down (bool) – whether to output paths as it goes (from root / down to the leaves)

Return type:

Iterator[tuple[Tree, list[str], list[str]]]

Returns:

equivalent output of pathlib.Path.walk()