Skip to content

Commit 2e579f0

Browse files
committed
Fix typos and style in compileall.
1 parent 8b9f0c5 commit 2e579f0

1 file changed

Lines changed: 12 additions & 18 deletions

File tree

Lib/compileall.py

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Module/script to "compile" all .py files to .pyc (or .pyo) file.
1+
"""Module/script to byte-compile all .py files to .pyc (or .pyo) files.
22
33
When called as a script with arguments, this compiles the directories
44
given as arguments recursively; the -l option prevents it from
@@ -9,14 +9,13 @@
99
packages -- for now, you'll have to deal with packages separately.)
1010
1111
See module py_compile for details of the actual byte-compilation.
12-
1312
"""
1413
import os
15-
import errno
1614
import sys
15+
import errno
16+
import imp
1717
import py_compile
1818
import struct
19-
import imp
2019

2120
__all__ = ["compile_dir","compile_file","compile_path"]
2221

@@ -33,7 +32,6 @@ def compile_dir(dir, maxlevels=10, ddir=None,
3332
force: if True, force compilation, even if timestamps are up-to-date
3433
quiet: if True, be quiet during compilation
3534
legacy: if True, produce legacy pyc paths instead of PEP 3147 paths
36-
3735
"""
3836
if not quiet:
3937
print('Listing', dir, '...')
@@ -55,10 +53,8 @@ def compile_dir(dir, maxlevels=10, ddir=None,
5553
if not os.path.isdir(fullname):
5654
if not compile_file(fullname, ddir, force, rx, quiet, legacy):
5755
success = 0
58-
elif maxlevels > 0 and \
59-
name != os.curdir and name != os.pardir and \
60-
os.path.isdir(fullname) and \
61-
not os.path.islink(fullname):
56+
elif (maxlevels > 0 and name != os.curdir and name != os.pardir and
57+
os.path.isdir(fullname) and not os.path.islink(fullname)):
6258
if not compile_dir(fullname, maxlevels - 1, dfile, force, rx,
6359
quiet, legacy):
6460
success = 0
@@ -73,7 +69,6 @@ def compile_file(fullname, ddir=None, force=0, rx=None, quiet=False,
7369
force: if True, force compilation, even if timestamps are up-to-date
7470
quiet: if True, be quiet during compilation
7571
legacy: if True, produce legacy pyc paths instead of PEP 3147 paths
76-
7772
"""
7873
success = 1
7974
name = os.path.basename(fullname)
@@ -141,7 +136,6 @@ def compile_path(skip_curdir=1, maxlevels=0, force=False, quiet=False,
141136
force: as for compile_dir() (default False)
142137
quiet: as for compile_dir() (default False)
143138
legacy: as for compile_dir() (default False)
144-
145139
"""
146140
success = 1
147141
for dir in sys.path:
@@ -165,26 +159,26 @@ def main():
165159
parser.add_argument('-f', action='store_true', dest='force',
166160
help='force rebuild even if timestamps are up to date')
167161
parser.add_argument('-q', action='store_true', dest='quiet',
168-
help='quiet operation')
162+
help='reduce output')
169163
parser.add_argument('-b', action='store_true', dest='legacy',
170-
help='procude legacy byte-compiled file paths')
164+
help='produce legacy byte-compiled file paths')
171165
parser.add_argument('-d', metavar='DESTDIR', dest='ddir', default=None,
172166
help=('purported directory name for error messages; '
173167
'if no directory arguments, -l sys.path '
174168
'is assumed.'))
175169
parser.add_argument('-x', metavar='REGEXP', dest='rx', default=None,
176170
help=('skip files matching the regular expression.\n\t'
177-
'The regexp is searched for in the full path'
171+
'The regexp is searched for in the full path '
178172
'of the file'))
179173
parser.add_argument('-i', metavar='FILE', dest='flist',
180-
help='expand the list with the contenent of FILE.')
174+
help='expand the list with the content of FILE.')
181175
parser.add_argument('compile_dest', metavar='FILE|DIR', nargs='?')
182176
args = parser.parse_args()
183177

184178
if (args.ddir and args.compile_dest != 1 and
185179
not os.path.isdir(args.compile_dest)):
186-
raise argparse.ArgumentError("-d destdir require exactly one "
187-
"directory argument")
180+
raise argparse.ArgumentError(
181+
"-d destdir requires exactly one directory argument")
188182
if args.rx:
189183
import re
190184
args.rx = re.compile(args.rx)
@@ -211,7 +205,7 @@ def main():
211205
else:
212206
return compile_path(legacy=args.legacy)
213207
except KeyboardInterrupt:
214-
print("\n[interrupt]")
208+
print("\n[interrupted]")
215209
return 0
216210
return 1
217211

0 commit comments

Comments
 (0)