Configuration helpers are methods provided by the conf object to help finding parameters, for example the method conf.find_program
def configure(conf): conf.find_program('test')
When a test fails, the exception Configure.ConfigurationException is raised.
When calling the configuration from a tool, for example:
def configure(conf): conf.check_tool('g++')
several different configuration helpers may be called: the first one for finding the compiler and the others for finding compiler flags. In some cases, it is interesting to disable some tests (unnecessary, time consuming, etc), to insert new tests, or to modify the existing tests. The check_tool method has a parameter for passing the list of checks to perform:
def configure(conf): conf.check_tool('g++', funs="find_gxx find_cpp find_ar gxx_common_flags")
If no check is performed, the configuration helpers are still attached to the conf object, and may be used later:
def configure(conf): conf.check_tool('g++', funs=[]) conf.find_gxx()
To ease the creation of projects split into modules, conf.check_tool will not load the tools twice for the same environment and the same parameters.
An error handler attached to the conf object is used for catching the Configuration exceptions and processing the errors. Here is how to replace the default configuration error handler by a custom method which may modify the list of tests, stop the evaluation, or re-raise the exception:
import Configure, Constants @conf def error_handler(fun, exc): print('exception %r' % exc) # other optionals return values: Constants.CONTINUE or anything else to re-raise the exception return Constants.BREAK
The following diagram illustrates the test execution loop performed from conf.check_tool