Skip to content
Myr

Template to module compilation should work on 3.x now.

Before adoption: this commit came in with the history the project adopted, so no landing records it.

--HG-- branch : trunk

authored by Armin Ronacher · committed by Armin Ronacher · parent f3c66d9 · Browse files · 1 file+7 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−5 removed

  • other:+7 added−5 removed

1 file+7 added−5 removed

modified:jinja2/environment.py+7 added-5 removed
530 unmodified lines
531 log_function = lambda x: None532533 if py_compile:534 import imp, struct, marshal535 py_header = imp.get_magic() + '\xff\xff\xff\xff'535 py_header = imp.get_magic() + \536 u'\xff\xff\xff\xff'.encode('iso-8859-15')537537 def write_file(filename, data):538 def write_file(filename, data, mode):539 if zip:540 info = ZipInfo(filename)541 info.external_attr = 0755 << 16L542 zip_file.writestr(info, data)543 else:543 f = open(os.path.join(target, filename), 'wb')544 f = open(os.path.join(target, filename), mode)545 try:546 f.write(data)547 finally:548 f.close()
22 unmodified lines
571 filename = ModuleLoader.get_module_filename(name)572573 if py_compile:574 c = compile(code, _encode_filename(filename), 'exec')574 write_file(filename + 'c', py_header + marshal.dumps(c))575 write_file(filename + 'c', py_header +576 marshal.dumps(c), 'wb')577 log_function('Byte-compiled "%s" as %s' %578 (name, filename + 'c'))579 else:578 write_file(filename, code)580 write_file(filename, code, 'w')581 log_function('Compiled "%s" as %s' % (name, filename))582 finally:583 if zip:584 zip_file.close()
500 unmodified lines