support enabling source annotation via CompilerOptions
authorStefan Behnel <scoder@users.berlios.de>
Fri, 9 May 2008 06:57:37 +0000 (08:57 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Fri, 9 May 2008 06:57:37 +0000 (08:57 +0200)
Cython/Compiler/Main.py
Cython/Compiler/ModuleNode.py

index efdedc69f1baf9b26c02a5e5cc49200533700f3a..5fc91545b34fd38ef5ffc8a5fb05dd18f1ce3c91 100644 (file)
@@ -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 = "")
index eead6a44537311abc7b682cddf1dc4d9b885ec16..f7d1d3fbb54640b31b35ae7986e3844f90eb3861 100644 (file)
@@ -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?