support 'language' option in distutils Extension
authorStefan Behnel <scoder@users.berlios.de>
Mon, 6 Aug 2007 06:19:48 +0000 (08:19 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Mon, 6 Aug 2007 06:19:48 +0000 (08:19 +0200)
Cython/Distutils/build_ext.py

index 6b775e7e0ff34b10471a5246090f475717f0a992..7b55fb581c8457878f2bbc6e5675b9647a8e66c6 100644 (file)
@@ -37,8 +37,12 @@ class build_ext (distutils.command.build_ext.build_ext):
         if not self.extensions:
             return
 
+        #suffix = self.swig_cpp and '.cpp' or '.c'
+        suffix = '.c'
         if extension is not None:
             module_name = extension.name
+            if extension.language == "c++":
+                suffix = ".cpp"
         else:
             module_name = None
 
@@ -46,8 +50,6 @@ class build_ext (distutils.command.build_ext.build_ext):
         pyx_sources = [source for source in sources if source.endswith('.pyx')]
         other_sources = [source for source in sources if not source.endswith('.pyx')]
 
-        #suffix = self.swig_cpp and '.cpp' or '.c'
-        suffix = '.c'
         for pyx in pyx_sources:
             # should I raise an exception if it doesn't exist?
             if os.path.exists(pyx):