Commit e878491e authored by Stefan Behnel's avatar Stefan Behnel

extract Cython 'cplus' option from Extension 'language' option

parent f3df1464
...@@ -39,9 +39,11 @@ class build_ext (distutils.command.build_ext.build_ext): ...@@ -39,9 +39,11 @@ class build_ext (distutils.command.build_ext.build_ext):
#suffix = self.swig_cpp and '.cpp' or '.c' #suffix = self.swig_cpp and '.cpp' or '.c'
suffix = '.c' suffix = '.c'
cplus = 0
if extension is not None: if extension is not None:
module_name = extension.name module_name = extension.name
if extension.language == "c++": if extension.language == "c++":
cplus = 1
suffix = ".cpp" suffix = ".cpp"
else: else:
module_name = None module_name = None
...@@ -56,14 +58,15 @@ class build_ext (distutils.command.build_ext.build_ext): ...@@ -56,14 +58,15 @@ class build_ext (distutils.command.build_ext.build_ext):
source = pyx source = pyx
target = replace_suffix(source, suffix) target = replace_suffix(source, suffix)
if newer(source, target) or self.force: if newer(source, target) or self.force:
self.cython_compile(source, module_name) self.cython_compile(source, module_name, cplus)
return [replace_suffix(src, suffix) for src in pyx_sources] + other_sources return [replace_suffix(src, suffix) for src in pyx_sources] + other_sources
def cython_compile(self, source, module_name): def cython_compile(self, source, module_name, cplus):
options = CompilationOptions(default_options, options = CompilationOptions(
include_path = self.include_dirs) default_options,
include_path = self.include_dirs,
cplus=cplus)
result = compile(source, options, full_module_name=module_name) result = compile(source, options, full_module_name=module_name)
if result.num_errors <> 0: if result.num_errors <> 0:
sys.exit(1) sys.exit(1)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment