changes for the Mac

This commit is contained in:
Guido van Rossum 1995-01-27 02:41:45 +00:00
parent f808012f5e
commit 7e4b2def34
5 changed files with 111 additions and 11 deletions

View file

@ -14,12 +14,17 @@ def compile(file, cfile = None):
import os, marshal, __builtin__
f = open(file)
codestring = f.read()
timestamp = os.fstat(f.fileno())[8]
f.close()
timestamp = os.stat(file)[8]
codeobject = __builtin__.compile(codestring, file, 'exec')
if not cfile:
cfile = file + 'c'
fc = open(cfile, 'w')
fc = open(cfile, 'wb')
wr_long(fc, MAGIC)
wr_long(fc, timestamp)
marshal.dump(codeobject, fc)
fc.close()
if os.name == 'mac':
import MacOS
MacOS.SetFileType(cfile, 'PYC ', 'PYTH')
MacOS.SetFileType(file, 'TEXT', 'PYTH')