@feature('f2py_fortran')
@before_method('process_source')
def add_fortran_tasks(task_gen):
    assert "f2py" in task_gen.features
    
    if hasattr(task_gen, "name"):
        module_name = task_gen.name
    else:
        raise ValueError("Please define a name for task_gen %r" % task_gen)
    if len(task_gen.source) < 1:
        raise ValueError("Gne ?")
    sources = task_gen.to_nodes(task_gen.source)
    module_node = sources[0].parent.find_or_declare("%smodule.c" % module_name)

    f2py_task = task_gen.create_task('f2py_fortran', sources, module_node)
    add_f2py_tasks(task_gen, f2py_task, module_name, module_node)
    f2py_task.env.F2PYFLAGS.extend(["--lower", "-m", module_name])
dataset/ETHPy150Open cournape/Bento/bento/backends/waf_tools/f2py.py/add_fortran_tasks/original