Commit 2e5168c9 authored by Sjoerd Mullender's avatar Sjoerd Mullender

Get magic number from interpreter (using module imp).

parent aa3e163f
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
# This has intimate knowledge of how Python/import.c does it. # This has intimate knowledge of how Python/import.c does it.
# By Sjoerd Mullender (I forced him to write it :-). # By Sjoerd Mullender (I forced him to write it :-).
MAGIC = 0x999903 import imp
MAGIC = imp.get_magic()
def wr_long(f, x): def wr_long(f, x):
f.write(chr( x & 0xff)) f.write(chr( x & 0xff))
...@@ -20,7 +21,7 @@ def compile(file, cfile = None): ...@@ -20,7 +21,7 @@ def compile(file, cfile = None):
if not cfile: if not cfile:
cfile = file + 'c' cfile = file + 'c'
fc = open(cfile, 'wb') fc = open(cfile, 'wb')
wr_long(fc, MAGIC) fc.write(MAGIC)
wr_long(fc, timestamp) wr_long(fc, timestamp)
marshal.dump(codeobject, fc) marshal.dump(codeobject, fc)
fc.close() fc.close()
......
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