From 7e4b2def34f5cb6c954148a7458c8e1aa4584320 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 27 Jan 1995 02:41:45 +0000 Subject: changes for the Mac --- Lib/py_compile.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Lib/py_compile.py') diff --git a/Lib/py_compile.py b/Lib/py_compile.py index ed54f47a70..98c5db082e 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') -- cgit v1.2.1