def test_load_store_simple(self): """Test one can load and store the contexts.""" ctx = get_cfg() ctx.store() ctx = get_bld() ctx.store()
def setUp(self): super(TestBuildYaku, self).setUp() ctx = get_cfg() ctx.use_tools(["ctasks", "pyext"]) ctx.store() self.yaku_build = get_bld() self._configure_context = ConfigureYakuContext self._build_context = BuildYakuContext
import yaku.task_manager from yaku.task_manager import get_extension_hook, set_file_hook from yaku.context import get_cfg, get_bld from yaku.scheduler import run_tasks def file_hook(self, node): print("Yo mama", node.name) return get_extension_hook(".c")(self, node) def configure(ctx): ctx.use_tools(["ctasks"]) set_file_hook(ctx, "src/fubar.c", file_hook) def build(ctx): builder = ctx.builders["ctasks"].program builder("src/main", sources=["src/main.c", "src/fubar.c"]) if __name__ == "__main__": cfg = get_cfg() configure(cfg) cfg.store() bld = get_bld() build(bld) run_tasks(bld) bld.store()
import \ get_bld, get_cfg from yaku.conftests.fconftests \ import \ check_fcompiler, check_fortran_verbose_flag, \ check_fortran_runtime_flags, check_fortran_dummy_main, \ check_fortran_mangling def configure(ctx): ctx.use_tools(["fortran", "ctasks"]) check_fcompiler(ctx) check_fortran_verbose_flag(ctx) check_fortran_runtime_flags(ctx) check_fortran_dummy_main(ctx) check_fortran_mangling(ctx) def build(ctx): builder = ctx.builders["fortran"] #builder.program("fbar", ["src/bar.f"]) if __name__ == "__main__": ctx = get_cfg() configure(ctx) ctx.store() ctx = get_bld() build(ctx) run_tasks(ctx) ctx.store()
import \ run_tasks def configure(ctx): # The tool ctask works as follows: # - When a tool is *loaded* (load_tool), get its configure function (dummy # is setup if no configure is found) # - When a tool is *used* (use_tool), run its configure function # - given a list of candidates, run the detect function for every candidate # until detect returns True # - if one candidate found, record its name and run its setup function # - if none found, fails tools = ctx.use_tools(["ctasks"]) def build(ctx): builder = ctx.builders["ctasks"] builder.program("main", [os.path.join("src", "main.c")]) if __name__ == "__main__": ctx = get_cfg() configure(ctx) ctx.store() ctx = get_bld() build(ctx) run_tasks(ctx) ctx.store()
def test_compiler(self): ctx = get_cfg() ctx.store() ctx = get_bld() ctx.store()
import \ run_tasks from yaku.context \ import \ get_bld, get_cfg def configure(ctx): ctx.use_tools(["ctasks", "cxxtasks"]) ctx.env.append("DEFINES", "_FOO") def build(ctx): builder = ctx.builders["cxxtasks"] builder.program("foo", ["src/main.cxx"]) builder = ctx.builders["ctasks"] builder.static_library("bar", ["src/bar.c"]) if __name__ == "__main__": build_path = "BBUILD" ctx = get_cfg(build_path=build_path) configure(ctx) ctx.store() ctx = get_bld(build_path=build_path) build(ctx) run_tasks(ctx) ctx.store()
from yaku.scheduler \ import \ run_tasks from yaku.context \ import \ get_bld, get_cfg def configure(ctx): ctx.use_tools(["ctasks", "cxxtasks"]) ctx.env.append("DEFINES", "_FOO") def build(ctx): builder = ctx.builders["cxxtasks"] builder.program("foo", ["src/main.cxx"]) builder = ctx.builders["ctasks"] builder.static_library("bar", ["src/bar.c"]) if __name__ == "__main__": build_path = "BBUILD" ctx = get_cfg(build_path=build_path) configure(ctx) ctx.store() ctx = get_bld(build_path=build_path) build(ctx) run_tasks(ctx) ctx.store()