# loki.transformations.build_system.file_write

Transformations to be used in build-system level tasks

Classes

`FileWriteTransformation`([suffix, cuf, ...]) | Write out modified source files to a select build directory

class FileWriteTransformation(suffix=None, cuf=False, include_module_var_imports=False)

  Bases: `Transformation`

  Write out modified source files to a select build directory

  Parameters:

    - suffix (str, optional) – File suffix to determine file type for all written file. If omitted, it will preserve the original file type.

    - cuf (bool, optional) – Use CUF (CUDA Fortran) backend instead of Fortran backend.

    - include_module_var_imports (bool, optional) – Flag to force the `Scheduler` traversal graph to recognise module variable imports and write the modified module files.

  traverse_file_graph = True
  property item_filter

    Override `item_filter` to configure whether module variable imports are honoured in the `Scheduler` traversal.

  transform_file(sourcefile, **kwargs)

    Defines the transformation to apply to `Sourcefile` items.

    For transformations that modify `Sourcefile` objects, this method should be implemented. It gets called via the dispatch method `apply()`.

    Parameters:

      - sourcefile (`Sourcefile`) – The sourcefile to be transformed.

      - **kwargs (optional) – Keyword arguments for the transformation.

  plan_file(sourcefile, **kwargs)

    Define the planning steps to apply for `Sourcefile` items.

    For transformations that modify the definitions or dependencies of `sourcefile` this should be implemented. It gets called via the dispatch method `apply()` if the optional `plan_mode` argument is set to True.

    Parameters:

      - sourcefile (`Sourcefile`) – The sourcefile to be transformed.

      - **kwargs (optional) – Keyword arguments for the transformation.