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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/cython/src/Tools/site_scons/site_tools/cython.py
diff --git a/third_party/cython/src/Tools/site_scons/site_tools/cython.py b/third_party/cython/src/Tools/site_scons/site_tools/cython.py
new file mode 100644
index 0000000000000000000000000000000000000000..40af7bb8db736e53da292cecffa3dd52876b3af9
--- /dev/null
+++ b/third_party/cython/src/Tools/site_scons/site_tools/cython.py
@@ -0,0 +1,66 @@
+"""
+Tool to run Cython files (.pyx) into .c and .cpp.
+
+TODO:
+ - Add support for dynamically selecting in-process Cython
+ through CYTHONINPROCESS variable.
+ - Have a CYTHONCPP option which turns on C++ in flags and
+ changes output extension at the same time
+
+VARIABLES:
+ - CYTHON - The path to the "cython" command line tool.
+ - CYTHONFLAGS - Flags to pass to the "cython" command line tool.
+
+AUTHORS:
+ - David Cournapeau
+ - Dag Sverre Seljebotn
+
+"""
+import SCons
+from SCons.Builder import Builder
+from SCons.Action import Action
+
+#def cython_action(target, source, env):
+# print target, source, env
+# from Cython.Compiler.Main import compile as cython_compile
+# res = cython_compile(str(source[0]))
+
+cythonAction = Action("$CYTHONCOM")
+
+def create_builder(env):
+ try:
+ cython = env['BUILDERS']['Cython']
+ except KeyError:
+ cython = SCons.Builder.Builder(
+ action = cythonAction,
+ emitter = {},
+ suffix = cython_suffix_emitter,
+ single_source = 1)
+ env['BUILDERS']['Cython'] = cython
+
+ return cython
+
+def cython_suffix_emitter(env, source):
+ return "$CYTHONCFILESUFFIX"
+
+def generate(env):
+ env["CYTHON"] = "cython"
+ env["CYTHONCOM"] = "$CYTHON $CYTHONFLAGS -o $TARGET $SOURCE"
+ env["CYTHONCFILESUFFIX"] = ".c"
+
+ c_file, cxx_file = SCons.Tool.createCFileBuilders(env)
+
+ c_file.suffix['.pyx'] = cython_suffix_emitter
+ c_file.add_action('.pyx', cythonAction)
+
+ c_file.suffix['.py'] = cython_suffix_emitter
+ c_file.add_action('.py', cythonAction)
+
+ create_builder(env)
+
+def exists(env):
+ try:
+# import Cython
+ return True
+ except ImportError:
+ return False
« 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