import os

from ctasks \
    import \
        ccompile_task
from task_manager \
    import \
        extension
from task \
    import \
        Task
from compiled_fun \
    import \
        compile_fun

@extension(".pyx")
def cython_task(self, node):
    base = os.path.splitext(node)[0]
    target = base + ".c"
    task = Task("cython", inputs=node, outputs=target)
    task.env_vars = []
    task.env = self.env
    task.func = compile_fun("cython", "cython ${SRC}", False)[0]
    ctask = ccompile_task(self, target)
    self.object_tasks.extend(ctask)
    return [task] + ctask

@@ -194,16 +194,61 @@
 pile_fun
+%0Afrom utils %5C%0A    import %5C%0A        ensure_dir
 %0A%0A@exten
@@ -343,19 +343,76 @@
 t = 
-base + %22.c%22
+os.path.join(self.env%5B%22BLDDIR%22%5D, base + %22.c%22)%0A    ensure_dir(target)
 %0A   
@@ -562,18 +562,56 @@
 n $%7BSRC%7D
-%22,
+ -o $%7BTGT%7D%22,%0A                           
  False)%5B

add build dir support to cython task.