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 cython_task(self, node): out = node.change_ext(".c") target = node.parent.declare(out.name) ensure_dir(target.name) task = Task("cython", inputs=[node], outputs=[target]) task.gen = self task.env_vars = [] task.env = self.env self.env["CYTHON_INCPATH"] = ["-I%s" % p for p in self.env["CYTHON_CPPPATH"]] task.func = compile_fun("cython", "${CYTHON} ${SRC} -o ${TGT} ${CYTHON_INCPATH}", False)[0] return [task]
def cython_task(self, node): out = node.change_ext(".c") target = node.parent.declare(out.name) ensure_dir(target.name) task = task_factory("cython")(inputs=[node], outputs=[target]) task.gen = self task.env_vars = [] task.env = self.env self.env["CYTHON_INCPATH"] = [ "-I%s" % p for p in self.env["CYTHON_CPPPATH"] ] task.func = compile_fun("cython", "${CYTHON} ${SRC} -o ${TGT} ${CYTHON_INCPATH}", False)[0] return [task]
def fortran_task(self, node): base = os.path.splitext(node)[0] # XXX: hack to avoid creating build/build/... when source is # generated. Dealing with this most likely requires a node concept if not base.startswith(self.env["BLDDIR"]): target = os.path.join(self.env["BLDDIR"], base + ".o") else: target = base + ".o" ensure_dir(target) func, env_vars = compile_fun("f77", "${F77} ${F77FLAGS} -c ${SRC} -o ${TGT[0]}", False) task = Task("f77", inputs=node, outputs=target) task.env_vars = env_vars task.env = self.env task.func = func self.object_tasks.append(task) return [task]
find_deps, ensure_dir from yaku.compiled_fun \ import \ compile_fun from yaku.errors \ import \ TaskRunFailure from yaku.scheduler \ import \ run_tasks from yaku.conf \ import \ with_conf_blddir import yaku.tools ccompile, cc_vars = compile_fun("cc", "${CC} ${CFLAGS} ${APP_DEFINES} ${INCPATH} ${CC_TGT_F}${TGT[0].abspath()} ${CC_SRC_F}${SRC}", False) ccprogram, ccprogram_vars = compile_fun("ccprogram", "${LINK} ${LINK_TGT_F}${TGT[0].abspath()} ${LINK_SRC_F}${SRC} ${APP_LIBDIR} ${APP_LIBS} ${LINKFLAGS}", False) cshlink, cshlink_vars = compile_fun("cshlib", "${SHLINK} ${APP_LIBDIR} ${APP_LIBS} ${SHLINK_TGT_F}${TGT[0].abspath()} ${SHLINK_SRC_F}${SRC} ${SHLINKFLAGS}", False) clink, clink_vars = compile_fun("clib", "${STLINK} ${STLINKFLAGS} ${STLINK_TGT_F}${TGT[0].abspath()} ${STLINK_SRC_F}${SRC}", False) @extension('.c') def c_hook(self, node): tasks = ccompile_task(self, node) self.object_tasks.extend(tasks) return tasks def ccompile_task(self, node): base = self.env["CC_OBJECT_FMT"] % node.name
apply_define from yaku.scheduler \ import \ run_tasks from yaku.conf \ import \ with_conf_blddir, create_file, write_log from yaku.errors \ import \ TaskRunFailure from yaku._config \ import \ _OUTPUT import yaku.tools pylink, pylink_vars = compile_fun("pylink", "${PYEXT_SHLINK} ${PYEXT_LINK_TGT_F}${TGT[0].abspath()} ${PYEXT_LINK_SRC_F}${SRC} ${PYEXT_APP_LIBDIR} ${PYEXT_APP_LIBS} ${PYEXT_APP_FRAMEWORKS} ${PYEXT_SHLINKFLAGS}", False) pycc, pycc_vars = compile_fun("pycc", "${PYEXT_CC} ${PYEXT_CFLAGS} ${PYEXT_INCPATH} ${PYEXT_CC_TGT_F}${TGT[0].abspath()} ${PYEXT_CC_SRC_F}${SRC}", False) pycxx, pycxx_vars = compile_fun("pycxx", "${PYEXT_CXX} ${PYEXT_CXXFLAGS} ${PYEXT_INCPATH} ${PYEXT_CXX_TGT_F}${TGT[0].abspath()} ${PYEXT_CXX_SRC_F}${SRC}", False) pycxxlink, pycxxlink_vars = compile_fun("pycxxlink", "${PYEXT_CXXSHLINK} ${PYEXT_LINK_TGT_F}${TGT[0].abspath()} ${PYEXT_LINK_SRC_F}${SRC} ${PYEXT_APP_LIBDIR} ${PYEXT_APP_LIBS} ${PYEXT_APP_FRAMEWORKS} ${PYEXT_SHLINKFLAGS}", False) # pyext env <-> sysconfig env conversion _SYS_TO_PYENV = { "PYEXT_SHCC": "CC", "PYEXT_CCSHARED": "CCSHARED", "PYEXT_SHLINK": "LDSHARED", "PYEXT_SUFFIX": "SO", "PYEXT_CFLAGS": "CFLAGS",
ensure_dir from yaku.tools.ctasks \ import \ apply_libdir from yaku.errors \ import \ TaskRunFailure from yaku.scheduler \ import \ run_tasks from yaku.conf \ import \ with_conf_blddir, create_file, write_log import yaku.tools f77_compile, f77_vars = compile_fun("f77", "${F77} ${F77FLAGS} ${F77_TGT_F}${TGT[0].abspath()} ${F77_SRC_F}${SRC}", False) fprogram, fprogram_vars = compile_fun("fprogram", "${F77_LINK} ${F77_LINK_SRC_F}${SRC} ${F77_LINK_TGT_F}${TGT[0].abspath()} ${APP_LIBDIR} ${F77_LINKFLAGS}", False) @extension(".f") def fortran_task(self, node): tasks = fcompile_task(self, node) return tasks def fcompile_task(self, node): base = self.env["F77_OBJECT_FMT"] % node.name target = node.parent.declare(base) ensure_dir(target.abspath()) task = task_factory("f77")(inputs=[node], outputs=[target]) task.gen = self
task_factory from yaku.task_manager \ import \ extension, CompiledTaskGen from yaku.utils \ import \ find_deps, ensure_dir, get_exception from yaku.compiled_fun \ import \ compile_fun from yaku.tools.ctasks \ import \ apply_cpppath, apply_libdir, apply_libs, apply_define import yaku.tools cxxcompile, cxx_vars = compile_fun("cxx", "${CXX} ${CXXFLAGS} ${INCPATH} ${APP_DEFINES} ${CXX_TGT_F}${TGT[0].abspath()} ${CXX_SRC_F}${SRC}", False) cxxprogram, cxxprogram_vars = compile_fun("cxxprogram", "${CXXLINK} ${CXXLINK_TGT_F}${TGT[0].abspath()} ${CXXLINK_SRC_F}${SRC} ${APP_LIBDIR} ${APP_LIBS} ${CXXLINKFLAGS}", False) @extension('.cxx') def cxx_hook(self, node): tasks = cxxcompile_task(self, node) self.object_tasks.extend(tasks) return tasks def cxxcompile_task(self, node): base = self.env["CXX_OBJECT_FMT"] % node.name target = node.parent.declare(base) ensure_dir(target.abspath()) task = task_factory("cxx")(inputs=[node], outputs=[target])
from yaku.errors \ import \ TaskRunFailure from yaku.scheduler \ import \ run_tasks from yaku.conf \ import \ with_conf_blddir from yaku._config \ import \ _OUTPUT import yaku.tools ccompile, cc_vars = compile_fun( "cc", "${CC} ${CFLAGS} ${APP_DEFINES} ${INCPATH} ${CC_TGT_F}${TGT[0].abspath()} ${CC_SRC_F}${SRC}", False) shccompile, sgcc_vars = compile_fun( "cc", "${CC} ${CFLAGS} ${CFLAGS_SH} ${APP_DEFINES} ${INCPATH} ${CC_TGT_F}${TGT[0].abspath()} ${CC_SRC_F}${SRC}", False) ccprogram, ccprogram_vars = compile_fun( "ccprogram", "${LINK} ${LINK_TGT_F}${TGT[0].abspath()} ${LINK_SRC_F}${SRC} ${APP_LIBDIR} ${APP_LIBS} ${LINKFLAGS}", False) cshlink, cshlink_vars = compile_fun( "cshlib", "${SHLINK} ${APP_LIBDIR} ${APP_LIBS} ${SHLINK_TGT_F}${TGT[0].abspath()} ${SHLINK_SRC_F}${SRC} ${SHLINKFLAGS}",
from yaku.tools.ctasks \ import \ apply_libdir from yaku.errors \ import \ TaskRunFailure from yaku.scheduler \ import \ run_tasks from yaku.conf \ import \ with_conf_blddir, create_file, write_log import yaku.tools f77_compile, f77_vars = compile_fun( "f77", "${F77} ${F77FLAGS} ${F77_TGT_F}${TGT[0].abspath()} ${F77_SRC_F}${SRC}", False) fprogram, fprogram_vars = compile_fun( "fprogram", "${F77_LINK} ${F77_LINK_SRC_F}${SRC} ${F77_LINK_TGT_F}${TGT[0].abspath()} ${APP_LIBDIR} ${F77_LINKFLAGS}", False) @extension(".f") def fortran_task(self, node): tasks = fcompile_task(self, node) return tasks def fcompile_task(self, node):
from yaku.scheduler \ import \ run_tasks from yaku.conf \ import \ with_conf_blddir, create_file, write_log from yaku.errors \ import \ TaskRunFailure from yaku._config \ import \ _OUTPUT import yaku.tools pylink, pylink_vars = compile_fun( "pylink", "${PYEXT_SHLINK} ${PYEXT_LINK_TGT_F}${TGT[0].abspath()} ${PYEXT_LINK_SRC_F}${SRC} ${PYEXT_APP_LIBDIR} ${PYEXT_APP_LIBS} ${PYEXT_APP_FRAMEWORKS} ${PYEXT_SHLINKFLAGS}", False) pycc, pycc_vars = compile_fun( "pycc", "${PYEXT_CC} ${PYEXT_CFLAGS} ${PYEXT_INCPATH} ${PYEXT_CC_TGT_F}${TGT[0].abspath()} ${PYEXT_CC_SRC_F}${SRC}", False) pycxx, pycxx_vars = compile_fun( "pycxx", "${PYEXT_CXX} ${PYEXT_CXXFLAGS} ${PYEXT_INCPATH} ${PYEXT_CXX_TGT_F}${TGT[0].abspath()} ${PYEXT_CXX_SRC_F}${SRC}", False) pycxxlink, pycxxlink_vars = compile_fun( "pycxxlink", "${PYEXT_CXXSHLINK} ${PYEXT_LINK_TGT_F}${TGT[0].abspath()} ${PYEXT_LINK_SRC_F}${SRC} ${PYEXT_APP_LIBDIR} ${PYEXT_APP_LIBS} ${PYEXT_APP_FRAMEWORKS} ${PYEXT_SHLINKFLAGS}",
import os from yaku.task \ import \ Task from yaku.task_manager \ import \ extension from yaku.utils \ import \ find_deps, ensure_dir from yaku.compiled_fun \ import \ compile_fun ccompile, cc_vars = compile_fun("cc", "${CC} ${CFLAGS} ${INCPATH} -o ${TGT[0]} -c ${SRC}", False) cshlink, cshlink_vars = compile_fun("cshlib", "${SHLINK} ${SHLINKFLAGS} ${APP_LIBDIR} ${APP_LIBS} -o ${TGT[0]} ${SRC}", False) @extension('.c') def c_hook(self, node): tasks = ccompile_task(self, node) self.object_tasks.extend(tasks) return tasks def ccompile_task(self, node): base = os.path.splitext(node)[0] # XXX: hack to avoid creating build/build/... when source is # generated. Dealing with this most likely requires a node concept if not os.path.commonprefix([self.env["BLDDIR"], base]): target = os.path.join(self.env["BLDDIR"], base + ".o")
compile_fun from yaku.task \ import \ Task from yaku.utils \ import \ ensure_dir # FIXME: should be done dynamically from yaku.tools.gcc \ import \ detect as gcc_detect from yaku.conftests \ import \ check_compiler, check_header pylink, pylink_vars = compile_fun("pylink", "${PYEXT_SHLINK} ${PYEXT_SHLINKFLAGS} ${PYEXT_APP_LIBDIR} ${PYEXT_APP_LIBS} -o ${TGT[0]} ${SRC}", False) pycc, pycc_vars = compile_fun("pycc", "${PYEXT_SHCC} ${PYEXT_CCSHARED} ${PYEXT_CFLAGS} ${PYEXT_INCPATH} -o ${TGT[0]} -c ${SRC}", False) _SYS_TO_PYENV = { "PYEXT_SHCC": "CC", "PYEXT_CCSHARED": "CCSHARED", "PYEXT_SHLINK": "LDSHARED", "PYEXT_SO": "SO", "PYEXT_CFLAGS": "CFLAGS", "PYEXT_OPT": "OPT", "PYEXT_LIBS": "LIBS", "PYEXT_INCPATH_FMT": "INCPATH_FMT", } def get_pyenv():
import os from yaku.task_manager \ import \ extension, get_extension_hook from yaku.task \ import \ Task from yaku.compiled_fun \ import \ compile_fun from yaku.utils \ import \ ensure_dir swig_func, swig_vars = compile_fun("swig", "${SWIG} ${SWIGFLAGS} -o ${TGT[0]} ${SRC}", False) @extension(".i") 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")
import os from yaku.task_manager \ import \ extension, get_extension_hook from yaku.task \ import \ task_factory from yaku.compiled_fun \ import \ compile_fun from yaku.utils \ import \ ensure_dir swig_func, swig_vars = compile_fun("swig", "${SWIG} ${SWIGFLAGS} -o ${TGT[0]} ${SRC}", False) @extension(".i") 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")