diff options
author | Guido van Rossum <guido@python.org> | 1998-03-26 21:13:24 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-03-26 21:13:24 (GMT) |
commit | 45e2fbc2e70ef28b1f0327207f33dab3a4e825c5 (patch) | |
tree | 24cafdb6ffb07170188292a02440935291327cde /Lib/py_compile.py | |
parent | 9ea7024754f0e42d7fc70fd1c8f6f6cfbf7e1cf0 (diff) | |
download | cpython-45e2fbc2e70ef28b1f0327207f33dab3a4e825c5.zip cpython-45e2fbc2e70ef28b1f0327207f33dab3a4e825c5.tar.gz cpython-45e2fbc2e70ef28b1f0327207f33dab3a4e825c5.tar.bz2 |
Mass check-in after untabifying all files that need it.
Diffstat (limited to 'Lib/py_compile.py')
-rw-r--r-- | Lib/py_compile.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Lib/py_compile.py b/Lib/py_compile.py index c58cc31..949de6c 100644 --- a/Lib/py_compile.py +++ b/Lib/py_compile.py @@ -20,9 +20,9 @@ def compile(file, cfile=None, dfile=None): file: source filename cfile: target filename; defaults to source with 'c' or 'o' appended - ('c' normally, 'o' in optimizing mode, giving .pyc or .pyo) + ('c' normally, 'o' in optimizing mode, giving .pyc or .pyo) dfile: purported filename; defaults to source (this is the filename - that will show up in error messages) + that will show up in error messages) Note that it isn't necessary to byte-compile Python modules for execution efficiency -- Python itself byte-compiles a module when @@ -44,16 +44,16 @@ def compile(file, cfile=None, dfile=None): import os, marshal, __builtin__ f = open(file) try: - timestamp = os.fstat(file.fileno()) + timestamp = os.fstat(file.fileno()) except AttributeError: - timestamp = long(os.stat(file)[8]) + timestamp = long(os.stat(file)[8]) codestring = f.read() f.close() if codestring and codestring[-1] != '\n': - codestring = codestring + '\n' + codestring = codestring + '\n' codeobject = __builtin__.compile(codestring, dfile or file, 'exec') if not cfile: - cfile = file + (__debug__ and 'c' or 'o') + cfile = file + (__debug__ and 'c' or 'o') fc = open(cfile, 'wb') fc.write('\0\0\0\0') wr_long(fc, timestamp) @@ -63,6 +63,6 @@ def compile(file, cfile=None, dfile=None): fc.write(MAGIC) fc.close() if os.name == 'mac': - import macfs - macfs.FSSpec(cfile).SetCreatorType('Pyth', 'PYC ') - macfs.FSSpec(file).SetCreatorType('Pyth', 'TEXT') + import macfs + macfs.FSSpec(cfile).SetCreatorType('Pyth', 'PYC ') + macfs.FSSpec(file).SetCreatorType('Pyth', 'TEXT') |