def build_extension(bld, extension, env=None):
    builder = bld.builders["pyext"]
    try:
        if env is None:
            env = {"PYEXT_CPPPATH": extension.include_dirs}
        else:
            val = env.get("PYEXT_CPPPATH", [])
            val.extend(extension.include_dirs)
        tasks = builder.extension(extension.name, extension.sources, env)
        if len(tasks) > 1:
            outputs = tasks[0].gen.outputs
        else:
            outputs = []
        return [n.bldpath() for n in outputs]
    except __HOLE__:
        e = extract_exception()
        msg = "Building extension %s failed: %s" % \
              (extension.name, str(e))
        raise CommandExecutionFailure(msg)
dataset/ETHPy150Open cournape/Bento/bento/commands/build_yaku.py/build_extension