fab.steps#

Predefined build steps with sensible defaults.

Functions

check_for_errors(results[, caller_label])

Check an iterable of results for any exceptions and handle them gracefully.

run_mp(config, items, func[, no_multiprocessing])

Called from Step.run() to process multiple items in parallel.

run_mp_imap(config, items, func, result_handler)

Like run_mp, but uses imap instead of map so that we can process each result as it happens.

step(func)

Function decorator for steps.

fab.steps.step(func)#

Function decorator for steps.

fab.steps.run_mp(config, items, func, no_multiprocessing=False)#

Called from Step.run() to process multiple items in parallel.

For example, a compile step would, in its run() method, find a list of source files in the artefact store. It could then pass those paths to this method, along with a function to compile a single file. The whole set of results are returned in a list-like, with undefined order.

Parameters:
  • items – An iterable of items to process in parallel.

  • func – A function to process a single item. Must accept a single argument.

  • no_multiprocessing (bool) – Overrides the config’s multiprocessing flag, disabling multiprocessing for this call. (default: False)

fab.steps.run_mp_imap(config, items, func, result_handler)#

Like run_mp, but uses imap instead of map so that we can process each result as it happens.

This is useful for a slow operation where we want to save our progress as we go instead of waiting for everything to finish, allowing us to pick up where we left off if the program is halted.

Parameters:
  • items – An iterable of items to process in parallel.

  • func – A function to process a single item. Must accept a single argument.

  • result_handler – A function to handle a single result. Must accept a single argument.

fab.steps.check_for_errors(results, caller_label=None)#

Check an iterable of results for any exceptions and handle them gracefully.

This is a helper function for steps which use multiprocessing, getting multiple results back from run_mp() all in one go.

Parameters:
  • results – An iterable of results.

  • caller_label – Optional human-friendly name of the caller for logging. (default: None)

Modules

analyse

Fab parses each C and Fortran file into an AnalysedDependent object which contains the symbol definitions and dependencies for that file.

archive_objects

Object archive creation from a list of object files for use in static linking.

c_pragma_injector

Add custom pragmas to C code which identify user and system include regions.

cleanup_prebuilds

Pruning of old files from the incremental/prebuild folder.

compile_c

C file compilation.

compile_fortran

Fortran file compilation.

find_source_files

Gather files from a source folder.

grab

Build steps for pulling source code from remote repos and local folders.

link

Link an executable.

preprocess

Fortran and C Preprocessing.

psyclone

A preprocessor and code generation step for PSyclone.

root_inc_files

A helper step to copy .inc files to the root of the build source folder, for easy include by the preprocessor.