Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: third_party/cython/src/Tools/site_scons/site_tools/cython.py

Issue 385073004: Adding cython v0.20.2 in third-party. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reference cython dev list thread. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 """
2 Tool to run Cython files (.pyx) into .c and .cpp.
3
4 TODO:
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
9
10 VARIABLES:
11 - CYTHON - The path to the "cython" command line tool.
12 - CYTHONFLAGS - Flags to pass to the "cython" command line tool.
13
14 AUTHORS:
15 - David Cournapeau
16 - Dag Sverre Seljebotn
17
18 """
19 import SCons
20 from SCons.Builder import Builder
21 from SCons.Action import Action
22
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]))
27
28 cythonAction = Action("$CYTHONCOM")
29
30 def create_builder(env):
31 try:
32 cython = env['BUILDERS']['Cython']
33 except KeyError:
34 cython = SCons.Builder.Builder(
35 action = cythonAction,
36 emitter = {},
37 suffix = cython_suffix_emitter,
38 single_source = 1)
39 env['BUILDERS']['Cython'] = cython
40
41 return cython
42
43 def cython_suffix_emitter(env, source):
44 return "$CYTHONCFILESUFFIX"
45
46 def generate(env):
47 env["CYTHON"] = "cython"
48 env["CYTHONCOM"] = "$CYTHON $CYTHONFLAGS -o $TARGET $SOURCE"
49 env["CYTHONCFILESUFFIX"] = ".c"
50
51 c_file, cxx_file = SCons.Tool.createCFileBuilders(env)
52
53 c_file.suffix['.pyx'] = cython_suffix_emitter
54 c_file.add_action('.pyx', cythonAction)
55
56 c_file.suffix['.py'] = cython_suffix_emitter
57 c_file.add_action('.py', cythonAction)
58
59 create_builder(env)
60
61 def exists(env):
62 try:
63 # import Cython
64 return True
65 except ImportError:
66 return False
OLDNEW
« no previous file with comments | « third_party/cython/src/Tools/kate.diff ('k') | third_party/cython/src/Tools/site_scons/site_tools/pyext.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698