fab.tools.tool_repository#

This file contains the ToolRepository class.

Classes

ToolRepository()

This class implements the tool repository.

class fab.tools.tool_repository.ToolRepository#

This class implements the tool repository. It stores a list of tools for various categories. For each compiler, it will automatically create a tool called “linker-{compiler-name}” which can be used for linking with the specified compiler.

Singleton access. Changes the value of _singleton so that the constructor can verify that it is indeed called from here.

add_tool(cls)#

Creates an instance of the specified class and adds it to the tool repository.

Parameters:

cls (Type[Any]) – the tool to instantiate.

get_tool(category, name)#
Return type:

Tool

Returns:

the tool with a given name in the specified category.

Parameters:
  • category (Category) – the name of the category in which to look for the tool.

  • name (str) – the name of the tool to find.

Raises:
  • KeyError – if there is no tool in this category.

  • KeyError – if no tool in the given category has the requested name.

set_default_compiler_suite(suite)#

Sets the default for linker and compilers to be of the given compiler suite.

Parameters:

suite (str) – the name of the compiler suite to make the default.

get_default(category)#

Returns the default tool for a given category, which is just the first tool in the category.

Parameters:

category (Category) – the category for which to return the default tool.

Raises:

KeyError – if the category does not exist.