2 Tool to run Cython files (.pyx) into .c and .cpp.
5 - Add support for dynamically selecting in-process Cython
6 through CYTHONINPROCESS variable.
7 - Have a CYTHONCPP option which turns on C++ in flags and
8 changes output extension at the same time
11 - CYTHON - The path to the "cython" command line tool.
12 - CYTHONFLAGS - Flags to pass to the "cython" command line tool.
16 - Dag Sverre Seljebotn
20 from SCons
.Builder
import Builder
21 from SCons
.Action
import Action
23 #def cython_action(target, source, env):
24 # print target, source, env
25 # from Cython.Compiler.Main import compile as cython_compile
26 # res = cython_compile(str(source[0]))
28 cythonAction
= Action("$CYTHONCOM")
30 def create_builder(env
):
32 cython
= env
['BUILDERS']['Cython']
34 cython
= SCons
.Builder
.Builder(
35 action
= cythonAction
,
37 suffix
= cython_suffix_emitter
,
39 env
['BUILDERS']['Cython'] = cython
43 def cython_suffix_emitter(env
, source
):
44 return "$CYTHONCFILESUFFIX"
47 env
["CYTHON"] = "cython"
48 env
["CYTHONCOM"] = "$CYTHON $CYTHONFLAGS -o $TARGET $SOURCE"
49 env
["CYTHONCFILESUFFIX"] = ".c"
51 c_file
, cxx_file
= SCons
.Tool
.createCFileBuilders(env
)
53 c_file
.suffix
['.pyx'] = cython_suffix_emitter
54 c_file
.add_action('.pyx', cythonAction
)
56 c_file
.suffix
['.py'] = cython_suffix_emitter
57 c_file
.add_action('.py', cythonAction
)