#! /usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2011 (ita) """ Map a compilation failure to a successs status. People playing with C++ templates might need this. """ top = '.' out = 'build' def options(opt): opt.load('compiler_cxx') def configure(conf): conf.load('compiler_cxx') def build(bld): bld.objects(source='success.cpp', target='ok') bld.objects(source='fail.cpp', target='fail', features='fail') ################################################################## # the feature 'fail' is defined below from waflib.Tools.cxx import cxx class cxxfail(cxx): def run(self): ret = super(cxxfail, self).run() self.outputs[0].write('just a simulation') return not ret def one_more_mapping(self, node): return self.create_compiled_task('cxxfail', node) from waflib.TaskGen import feature, before @before('process_source') @feature('fail') def remap_failure_to_success(self): self.mappings['.cpp'] = one_more_mapping