fmf_jinja.template

Module for the Template fmf data type.

fmf_jinja.template.DEFAULT_JINJA_ENV = <jinja2.environment.Environment object>

Default settings for the jinja environment.

class fmf_jinja.template.TemplateContext(tree_root, previous_ctx=None, recursive=True)

Bases: object

Generator’s run context.

tree_root: Tree

Full fmf tree being processed.

jinja_env: Environment

The base jinja environment.

previous_ctx: TemplateContext | None

The context of the previous run.

recursive: bool

Whether to recursively generate the templated files.

generated_fmf: bool

Whether a fmf file was generated in the current run.

property curr_path: str

Current path string that is being processed.

property tmp_path: Path

Temporary path where the current run’s output is placed.

property output_path: Path

Output path of the current node being processed.

property tree: Tree

Current fmf tree node.

property tree_path: Path

Path to the current tree node.

tree_root_path: Path
fmf_files: set[Path]
join_path(path, output_root=None)

Join a path to the current tree context.

If the path is absolute, it navigates from the tree root or output_root, otherwise it navigates from the current node’s path.

Parameters:
  • path (Path) – path object to join

  • output_root (Path | None) – root path where to construct the path. Defaults to tree_root_path

Return type:

Path

Returns:

joined path

generate(output)

Generate the templated files from the tree’s data.

Parameters:

output (Path) – output path where the rendered fmf tree is placed

Return type:

None