def cythonize(module_list, nthreads=0, aliases=None, **options):
c_options = CompilationOptions(options)
cpp_options = CompilationOptions(options); cpp_options.cplus = True
- ctx = options.create_context()
+ ctx = c_options.create_context()
module_list = create_extension_list(module_list, ctx=ctx, aliases=aliases)
deps = create_dependency_tree(ctx)
to_compile = []
def run_pipeline(source, options, full_module_name = None):
# Set up context
- context = optons.create_context()
+ context = options.create_context()
# Set up source object
cwd = os.getcwd()
--- /dev/null
+PYTHON setup.py build_ext --inplace
+PYTHON -c "import a; a.use_vector([1,2,3])"
+
+######## setup.py ########
+
+from Cython.Build.Dependencies import cythonize
+
+from distutils.core import setup
+
+setup(
+ ext_modules = cythonize("*.pyx"),
+)
+
+######## a.pyx ########
+
+# distutils: language = c++
+
+from libcpp.vector cimport vector
+
+def use_vector(L):
+ try:
+ v = new vector[int]()
+ for a in L:
+ v.push_back(a)
+ return v.size()
+ finally:
+ del v