another Distutils fix: keep source directory as target if not requested otherwise
authorStefan Behnel <scoder@users.berlios.de>
Tue, 1 Jan 2008 09:52:53 +0000 (10:52 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Tue, 1 Jan 2008 09:52:53 +0000 (10:52 +0100)
Cython/Distutils/build_ext.py

index 476967623ebfe16f9b05704675444ae1b96422d0..3b828900593c049204bf47dd2405b6b5d9127472 100644 (file)
@@ -153,12 +153,13 @@ class build_ext(_build_ext.build_ext):
                 or getattr(extension, 'pyrex_c_in_temp', 0)):
             target_dir = os.path.join(self.build_temp, "pyrex")
         else:
-            target_dir = ""
+            target_dir = None
 
         for source in sources:
             (base, ext) = os.path.splitext(os.path.basename(source))
             if ext == ".pyx":                    # Cython source file
-                new_sources.append(os.path.join(target_dir, base + target_ext))
+                output_dir = target_dir or os.path.dirname(source)
+                new_sources.append(os.path.join(output_dir, base + target_ext))
                 pyrex_sources.append(source)
                 pyrex_targets[source] = new_sources[-1]
             else: