summaryrefslogtreecommitdiffstats
path: root/Lib/py_compile.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-01-27 02:41:45 (GMT)
committerGuido van Rossum <guido@python.org>1995-01-27 02:41:45 (GMT)
commit7e4b2def34f5cb6c954148a7458c8e1aa4584320 (patch)
tree9b6a93f3726eac8f595329bc87e56d248df4a0ac /Lib/py_compile.py
parentf808012f5e41b491c7348f8189e37c30b7cbf1a0 (diff)
downloadcpython-7e4b2def34f5cb6c954148a7458c8e1aa4584320.zip
cpython-7e4b2def34f5cb6c954148a7458c8e1aa4584320.tar.gz
cpython-7e4b2def34f5cb6c954148a7458c8e1aa4584320.tar.bz2
changes for the Mac
Diffstat (limited to 'Lib/py_compile.py')
-rw-r--r--Lib/py_compile.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/py_compile.py b/Lib/py_compile.py
index ed54f47..98c5db0 100644
--- a/Lib/py_compile.py
+++ b/Lib/py_compile.py
@@ -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')