Tools

The tools are used by the yace Emitter Targets via Mix-In classes in the module yace.tools.

Tools used by targets to do what they do. The tool-classes are wrapper-classes around executables. A brief overview:

The tools listed above can be classified in the following two categories.

Code Formaters

Tools such as source-code formaters (clang-format, black, isort, rustfmt), these will change the given code according to style-definitions. When these tools change files, then they typically terminate using a non-zero exit-code. This is not an error as it is commonly what we wanted the tool to do, that is a target emits format and invokes a format-tool to make it conform.

Thus the tool is usually invoked twice, once for formating, and a second time for checking that the code is well-formatted.

The above tools needs to be installed on the system. These classes inherit the run() from the Tool. Invoking a system Tool raises ToolError.

Compilers

Compilers such as Gcc usually terminate with a non-zero exit-code when the input-program / source is invalid. Re-running the compiler does not change this, the program needs to be changed. Something is wrong, and the user needs to fix it.

Interpreters

class yace.tools.Black(cwd)

Wrapper for the system-tool black, usually utilized to format code emitted by Python-targets

exists()

Returns true if the tool exists.

run(args: List[str])

Invoke subprocess.run([self.executable] + args, …); logging stdout and stderr to the given ‘logfile’ using arguments and self.cwd as cwd.

On success, proc is returned.

class yace.tools.ClangFormat(cwd)

Wrapper for clang-format

CLANGFORMAT_BIN = 'clang-format'
CLANGFORMAT_STYLE_C = 'clang-format-c.clang-format'
CLANGFORMAT_STYLE_H = 'clang-format-h.clang-format'
exists()

Returns true if the tool exists.

run(args: List[str])

Invoke subprocess.run([self.executable] + args, …); logging stdout and stderr to the given ‘logfile’ using arguments and self.cwd as cwd.

On success, proc is returned.

class yace.tools.Doxygen(cwd)

Wrapper for doxygen

Run ‘doxygen’ using Doxygen.DOXYGEN_CONF

DOXYGEN_BIN = 'doxygen'
DOXYGEN_CONF = 'doxygen.conf'
exists()

Returns true if the tool exists.

run(args: List[str])

Invoke subprocess.run([self.executable] + args, …); logging stdout and stderr to the given ‘logfile’ using arguments and self.cwd as cwd.

On success, proc is returned.

class yace.tools.Gcc(cwd)

Wrapper for gcc

exists()

Returns true if the tool exists.

run(args: List[str])

Invoke subprocess.run([self.executable] + args, …); logging stdout and stderr to the given ‘logfile’ using arguments and self.cwd as cwd.

On success, proc is returned.

class yace.tools.Isort(cwd)

Wrapper for isort

exists()

Returns true if the tool exists.

run(args: List[str])

Invoke subprocess.run([self.executable] + args, …); logging stdout and stderr to the given ‘logfile’ using arguments and self.cwd as cwd.

On success, proc is returned.

class yace.tools.Python3(cwd)

Wrapper for python3

exists()

Returns true if the tool exists.

run(args: List[str])

Invoke subprocess.run([self.executable] + args, …); logging stdout and stderr to the given ‘logfile’ using arguments and self.cwd as cwd.

On success, proc is returned.

class yace.tools.Tool(executable, cwd)

Wrapper-class for invoking system tools

exists()

Returns true if the tool exists.

run(args: List[str])

Invoke subprocess.run([self.executable] + args, …); logging stdout and stderr to the given ‘logfile’ using arguments and self.cwd as cwd.

On success, proc is returned.