def create_compile_conf_taskgen(conf, name, body, headers, msg, extension=".c"): if headers: head = "\n".join(["#include <%s>" % h for h in headers]) else: head = "" code = "\n".join([c for c in [head, body]]) sources = [create_file(conf, code, name, extension)] task_gen = CompiledTaskGen("conf", sources, name) task_gen.env.update(copy.deepcopy(conf.env)) task_gen.env["INCPATH"] = "" tasks = create_tasks(task_gen, sources) for t in tasks: t.disable_output = True sys.stderr.write(msg + "... ") succeed = False explanation = None try: run_tasks(conf, tasks) succeed = True sys.stderr.write("yes\n") except TaskRunFailure, e: sys.stderr.write("no\n") explanation = str(e)
def create_pyext(bld, env, name, sources): base = name.replace(".", os.sep) tasks = [] task_gen = CompiledTaskGen("pyext", sources, name) old_hook = set_extension_hook(".c", pycc_hook) task_gen.env = env apply_cpppath(task_gen) apply_libpath(task_gen) apply_libs(task_gen) tasks = create_tasks(task_gen, sources) ltask = pylink_task(task_gen, base) tasks.extend(ltask) for t in tasks: t.env = task_gen.env set_extension_hook(".c", old_hook) bld.tasks.extend(tasks) outputs = [] for t in ltask: outputs.extend(t.outputs) return outputs
def create_sources(ctx, name, sources): tasks = create_tasks(ctx, sources) run_tasks(ctx, tasks)