From: Stefan Behnel Date: Sat, 9 Aug 2008 10:33:37 +0000 (+0200) Subject: quick way to enable multiple compilation *without* reusing contexts (still about... X-Git-Tag: 0.9.8.1~79 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=714cad97e378d4c6711ad88f8355f783ecfe5071;p=cython.git quick way to enable multiple compilation *without* reusing contexts (still about 10x faster than separate startup) --- diff --git a/Cython/Compiler/Main.py b/Cython/Compiler/Main.py index db3f2521..6bda38d5 100644 --- a/Cython/Compiler/Main.py +++ b/Cython/Compiler/Main.py @@ -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) #------------------------------------------------------------------------ #