quick way to enable multiple compilation *without* reusing contexts (still about...
authorStefan Behnel <scoder@users.berlios.de>
Sat, 9 Aug 2008 10:33:37 +0000 (12:33 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Sat, 9 Aug 2008 10:33:37 +0000 (12:33 +0200)
Cython/Compiler/Main.py

index db3f25210cbbdf11f61a567592e54ebcff51586a..6bda38d5dbbd940b242d2c5cafcdf917b3a0398b 100644 (file)
@@ -405,19 +405,9 @@ def create_default_resultobj(compilation_source, options):
         else:
             c_suffix = ".c"
         result.c_file = Utils.replace_suffix(source_desc.filename, c_suffix)
-    # The below doesn't make any sense? Why is it there?
-    c_stat = None
-    if result.c_file:
-        try:
-            c_stat = os.stat(result.c_file)
-        except EnvironmentError:
-            pass
     return result
 
-def run_pipeline(source, options, full_module_name = None):
-    # Set up context
-    context = Context(options.include_path)
-
+def run_pipeline(source, context, options, full_module_name = None):
     # Set up source object
     cwd = os.getcwd()
     source_desc = FileSourceDescriptor(os.path.join(cwd, source))
@@ -541,7 +531,8 @@ def compile_single(source, options, full_module_name = None):
     Always compiles a single file; does not perform timestamp checking or
     recursion.
     """
-    return run_pipeline(source, options, full_module_name)
+    context = Context(options.include_path)
+    return run_pipeline(source, context, options, full_module_name)
 #    context = Context(options.include_path)
 #    return context.compile(source, options, full_module_name)
 
@@ -563,15 +554,15 @@ def compile_multiple(sources, options):
         timestamps = recursive
     verbose = options.verbose or ((recursive or timestamps) and not options.quiet)
     for source in sources:
-        context = Context(options.include_path) # to be removed later
         if source not in processed:
+            # Compiling multiple sources in one context doesn't quite
+            # work properly yet.
+            context = Context(options.include_path) # to be removed later
             if not timestamps or context.c_file_out_of_date(source):
                 if verbose:
                     sys.stderr.write("Compiling %s\n" % source)
 
-                result = context.compile(source, options)
-                # Compiling multiple sources in one context doesn't quite
-                # work properly yet.
+                result = run_pipeline(source, context, options)
                 results.add(source, result)
             processed.add(source)
             if recursive:
@@ -601,10 +592,7 @@ def compile(source, options = None, c_compile = 0, c_link = 0,
             and not options.recursive:
         return compile_single(source, options, full_module_name)
     else:
-        # Hack it for wednesday dev1
-        assert len(source) == 1
-        return compile_single(source[0], options)
-#        return compile_multiple(source, options)
+        return compile_multiple(source, options)
 
 #------------------------------------------------------------------------
 #