def cython_task(self, node): base = os.path.splitext(node)[0] target = os.path.join(self.env["BLDDIR"], base + ".c") ensure_dir(target) task = Task("cython", inputs=node, outputs=target) task.env_vars = [] task.env = self.env task.func = compile_fun("cython", "cython ${SRC} -o ${TGT}", False)[0] compile_task = get_extension_hook(".c") ctask = compile_task(self, target) return [task] + ctask
def build(ctx): pyext = ctx.builders["pyext"] old_hook = get_extension_hook(".in") def foo(self, node): recursive_suffixes = [".c", ".cxx", ".pyx"] out = node.change_ext("") # XXX: is it really safe to items to a list one recurses on ? if out.suffix() in recursive_suffixes: self.sources.append(out) return old_hook(self, node) set_extension_hook(".in", foo) pyext.extension("hello", ["hello.pyx.in"])
def swig_hook(self, name): # FIXME: only handle C extension (no C++) base = os.path.splitext(name)[0] target = os.path.join(self.env["BLDDIR"], base) targets = [target + "_wrap.c", target + ".py"] for t in targets: ensure_dir(t) task = Task("swig", inputs=name, outputs=targets) task.func = swig_func task.env_vars = swig_vars task.env = self.env compile_task = get_extension_hook(".c") ctask = compile_task(self, targets[0]) return [task] + ctask
def swig_hook(self, name): # FIXME: only handle C extension (no C++) base = os.path.splitext(name)[0] target = os.path.join(self.env["BLDDIR"], base) targets = [target + "_wrap.c", target + ".py"] for t in targets: ensure_dir(t) task = task_factory("swig")(inputs=name, outputs=targets) task.func = swig_func task.env_vars = swig_vars task.env = self.env compile_task = get_extension_hook(".c") ctask = compile_task(self, targets[0]) return [task] + ctask
def file_hook(self, node): print("Yo mama", node.name) return get_extension_hook(".c")(self, node)