mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
changes for the Mac
This commit is contained in:
parent
f808012f5e
commit
7e4b2def34
5 changed files with 111 additions and 11 deletions
|
|
@ -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')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue