Commit ce8776b3 authored by Robert Bradshaw's avatar Robert Bradshaw

Allow deterministic "generated by" string for easy comparison.

parent cc452cb6
......@@ -86,7 +86,7 @@ class AnnotationCCodeWriter(CCodeWriter):
html_filename = os.path.splitext(target_filename)[0] + ".html"
f = codecs.open(html_filename, "w", encoding="UTF-8")
f.write(u'<!-- Generated by Cython %s on %s -->\n' % (Version.version, time.asctime()))
f.write(u'<!-- Generated by Cython %s -->\n' % Version.watermark)
f.write(u'<html>\n')
f.write(u"""
<head>
......@@ -127,7 +127,7 @@ function toggleDiv(id) {
</head>
""")
f.write(u'<body>\n')
f.write(u'<p>Generated by Cython %s on %s\n' % (Version.version, time.asctime()))
f.write(u'<p>Generated by Cython %s\n' % Version.watermark)
c_file = Utils.decode_filename(os.path.basename(target_filename))
f.write(u'<p>Raw output: <a href="%s">%s</a>\n' % (c_file, c_file))
k = 0
......
......@@ -27,6 +27,7 @@ from Code import UtilityCode
from StringEncoding import EncodedString
def check_c_declarations_pxd(module_node):
module_node.scope.check_c_classes_pxd()
return module_node
......@@ -491,8 +492,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
self.generate_cfunction_declarations(module, modulecode, defined_here)
def generate_module_preamble(self, env, cimported_modules, code):
code.putln("/* Generated by Cython %s on %s */" % (
Version.version, time.asctime()))
code.putln("/* Generated by Cython %s */" % Version.watermark)
code.putln("")
code.putln("#define PY_SSIZE_T_CLEAN")
for filename in env.python_include_files:
......
# for backwards compatibility
from Cython import __version__ as version
# For generated by string.
import time
watermark = "%s on %s" % (version, time.asctime())
......@@ -1443,6 +1443,8 @@ def main():
help="configure for easier use with a debugger (e.g. gdb)")
parser.add_option("--pyximport-py", dest="pyximport_py", default=False, action="store_true",
help="use pyximport to automatically compile imported .pyx and .py files")
parser.add_option("--watermark", dest="watermark", default=None,
help="deterministic generated by string")
options, cmd_args = parser.parse_args()
......@@ -1472,6 +1474,10 @@ def main():
else:
options.with_cython = False
if options.watermark:
import Cython.Compiler.Version
Cython.Compiler.Version.watermark = options.watermark
WITH_CYTHON = options.with_cython
coverage = None
......
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