def getPycHeader(filename):
# compile.c uses marshal to write a long directly, with
# calling the interface that would also generate a 1-byte code
# to indicate the type of the value. simplest way to get the
# same effect is to call marshal and then skip the code.
#mtime = os.path.getmtime(filename)
mtime = 0 # to make it deterministic for now
mtime = struct.pack('<i', int(mtime))
return imp.get_magic() + mtime
评论列表
文章目录