craftr.ext.compiler

This module provides common utility functions that are used by compiler interface implementations, for example to convert source filenames to object filenames using gen_objects().

Functions

craftr.ext.compiler.detect_compiler(program, language)[source]

Detects the compiler interface based on the specified program assuming it is used for the specified language. Returns the detected compiler or raises ToolDetectionError. Supports all available compiler toolset implementations.

craftr.ext.compiler.gen_output_dir(output_dir)[source]

Given an output directory that is a relative path, it will be prefixed with the current modules’ project name. An absolute path is left unchanged. If None is given, the current working directory is returned.

craftr.ext.compiler.gen_output(output, output_dir='', suffix=None)[source]
craftr.ext.compiler.gen_objects(sources, output_dir='obj', suffix=None)[source]
craftr.ext.compiler.remove_flags(command, remove_flags, builder=None)[source]

Helper function to remove flags from a command.

Parameters:
  • command – A list of command-line arguments.
  • remove_flags – An iterable of flags to remove.
  • builder – Optionally, a craftr.TargetBuilder that will be used for logging.
Returns:

The “command” list, but it is also directly altered.

Exceptions

class craftr.ext.compiler.ToolDetectionError[source]

This exception is raised if a command-line tool could not be successfully be detected.