fab.build_config module¶
Contains the BuildConfig
and helper classes.
- class fab.build_config.BuildConfig(project_label, parsed_args=None, multiprocessing=True, n_procs=None, reuse_artefacts=False, fab_workspace=None)¶
Bases:
object
Contains and runs a list of build steps.
The user is not expected to instantiate this class directly, but rather through the build_config() context manager.
- Parameters:
project_label (
str
) – Name of the build project. The project workspace folder is created from this name, with spaces replaced by underscores.parsed_args (
Optional
[Namespace
]) – (default:None
) If you want to add arguments to your script, please use common_arg_parser() and add arguements. This pararmeter is the result of runningArgumentParser.parse_args()
.multiprocessing (
bool
) – (default:True
) An option to disable multiprocessing to aid debugging.n_procs (
Optional
[int
]) – (default:None
) The number of cores to use for multiprocessing operations. Defaults to the number of available cores.reuse_artefacts (
bool
) – (default:False
) A flag to avoid reprocessing certain files on subsequent runs. WARNING: Currently unsophisticated, this flag should only be used by Fab developers. The logic behind flag will soon be improved, in a work package called “incremental build”.fab_workspace (
Optional
[Path
]) – (default:None
) Overrides the FAB_WORKSPACE environment variable. If not set, and FAB_WORKSPACE is not set, the fab workspace defaults to ~/fab-workspace.
- property build_output¶
- init_artefact_store()¶
- add_current_prebuilds(artefacts)¶
Mark the given file paths as being current prebuilds, not to be cleaned during housekeeping.
- class fab.build_config.AddFlags(match, flags)¶
Bases:
object
Add command-line flags when our path filter matches. Generally used inside a
FlagsConfig
.- Parameters:
Both the match and flags arguments can make use of templating:
$source for <project workspace>/source
$output for <project workspace>/build_output
$relative for <the source file’s folder>
For example:
# For source in the um folder, add an absolute include path AddFlags(match="$source/um/*", flags=['-I$source/include']), # For source in the um folder, add an include path relative to each source file. AddFlags(match="$source/um/*", flags=['-I$relative/include']),
- run(fpath, input_flags, config)¶
Check if our filter matches a given file. If it does, add our flags.