From 0aea8272512c851c48f4851e5883d16a27fbafac Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 9 May 2008 08:57:37 +0200 Subject: [PATCH] support enabling source annotation via CompilerOptions --- Cython/Compiler/Main.py | 1 + Cython/Compiler/ModuleNode.py | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cython/Compiler/Main.py b/Cython/Compiler/Main.py index efdedc69..5fc91545 100644 --- a/Cython/Compiler/Main.py +++ b/Cython/Compiler/Main.py @@ -351,6 +351,7 @@ default_options = dict( obj_only = 1, cplus = 0, output_file = None, + annotate = False, generate_pxi = 0, transforms = Transform.TransformSet(), working_path = "") diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index eead6a44..f7d1d3fb 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -209,7 +209,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): def generate_c_code(self, env, options, result): modules = self.referenced_modules - if Options.annotate: + if Options.annotate or options.annotate: code = Annotate.AnnotationCCodeWriter(StringIO()) else: code = Code.CCodeWriter(StringIO()) @@ -239,14 +239,13 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): self.generate_declarations_for_modules(env, modules, code.h) - f = open_new_file(result.c_file) f.write(code.h.f.getvalue()) f.write("\n") f.write(code.f.getvalue()) f.close() result.c_file_generated = 1 - if Options.annotate: + if Options.annotate or options.annotate: self.annotate(code) code.save_annotation(result.c_file[:-1] + "pyx") # change? -- 2.26.2