Commit 736d715f authored by Stefan Behnel's avatar Stefan Behnel

Merge branch 'master' of git+ssh://github.com/cython/cython

parents 977f99c4 e05dc496
...@@ -30,6 +30,7 @@ from . import Naming ...@@ -30,6 +30,7 @@ from . import Naming
from . import Options from . import Options
from . import DebugFlags from . import DebugFlags
from . import StringEncoding from . import StringEncoding
from . import Version
from .. import Utils from .. import Utils
from .Scanning import SourceDescriptor from .Scanning import SourceDescriptor
from ..StringIOTree import StringIOTree from ..StringIOTree import StringIOTree
...@@ -1818,6 +1819,10 @@ class CCodeWriter(object): ...@@ -1818,6 +1819,10 @@ class CCodeWriter(object):
self.putln("%sconst char *%s = NULL;" % (unused, Naming.filename_cname)) self.putln("%sconst char *%s = NULL;" % (unused, Naming.filename_cname))
self.putln("%sint %s = 0;" % (unused, Naming.clineno_cname)) self.putln("%sint %s = 0;" % (unused, Naming.clineno_cname))
def put_generated_by(self):
self.putln("/* Generated by Cython %s */" % Version.watermark)
self.putln("")
def put_h_guard(self, guard): def put_h_guard(self, guard):
self.putln("#ifndef %s" % guard) self.putln("#ifndef %s" % guard)
self.putln("#define %s" % guard) self.putln("#define %s" % guard)
......
...@@ -21,7 +21,6 @@ from . import Naming ...@@ -21,7 +21,6 @@ from . import Naming
from . import Nodes from . import Nodes
from . import Options from . import Options
from . import TypeSlots from . import TypeSlots
from . import Version
from . import PyrexTypes from . import PyrexTypes
from .Errors import error, warning from .Errors import error, warning
...@@ -140,6 +139,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -140,6 +139,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
else: else:
i_code = None i_code = None
h_code.put_generated_by()
h_guard = Naming.h_guard_prefix + self.api_name(env) h_guard = Naming.h_guard_prefix + self.api_name(env)
h_code.put_h_guard(h_guard) h_code.put_h_guard(h_guard)
h_code.putln("") h_code.putln("")
...@@ -207,6 +207,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -207,6 +207,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
result.api_file = replace_suffix(result.c_file, "_api.h") result.api_file = replace_suffix(result.c_file, "_api.h")
h_code = Code.CCodeWriter() h_code = Code.CCodeWriter()
Code.GlobalState(h_code, self) Code.GlobalState(h_code, self)
h_code.put_generated_by()
api_guard = Naming.api_guard_prefix + self.api_name(env) api_guard = Naming.api_guard_prefix + self.api_name(env)
h_code.put_h_guard(api_guard) h_code.put_h_guard(api_guard)
h_code.putln('#include "Python.h"') h_code.putln('#include "Python.h"')
...@@ -562,8 +563,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -562,8 +563,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
self.generate_cfunction_declarations(module, modulecode, defined_here) self.generate_cfunction_declarations(module, modulecode, defined_here)
def generate_module_preamble(self, env, cimported_modules, metadata, code): def generate_module_preamble(self, env, cimported_modules, metadata, code):
code.putln("/* Generated by Cython %s */" % Version.watermark) code.put_generated_by()
code.putln("")
if metadata: if metadata:
code.putln("/* BEGIN: Cython Metadata") code.putln("/* BEGIN: Cython Metadata")
code.putln(json.dumps(metadata, indent=4, sort_keys=True)) code.putln(json.dumps(metadata, indent=4, sort_keys=True))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment