mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Standardize whitespace in function calls.
This commit is contained in:
parent
449f5568b7
commit
071ed76732
4 changed files with 145 additions and 147 deletions
|
@ -59,13 +59,13 @@ class Command:
|
|||
# late import because of mutual dependence between these classes
|
||||
from distutils.dist import Distribution
|
||||
|
||||
if not isinstance (dist, Distribution):
|
||||
if not isinstance(dist, Distribution):
|
||||
raise TypeError, "dist must be a Distribution instance"
|
||||
if self.__class__ is Command:
|
||||
raise RuntimeError, "Command is an abstract class"
|
||||
|
||||
self.distribution = dist
|
||||
self.initialize_options ()
|
||||
self.initialize_options()
|
||||
|
||||
# Per-command versions of the global flags, so that the user can
|
||||
# customize Distutils' behaviour command-by-command and let some
|
||||
|
@ -98,9 +98,9 @@ class Command:
|
|||
|
||||
def __getattr__ (self, attr):
|
||||
if attr in ('verbose', 'dry_run'):
|
||||
myval = getattr (self, "_" + attr)
|
||||
myval = getattr(self, "_" + attr)
|
||||
if myval is None:
|
||||
return getattr (self.distribution, attr)
|
||||
return getattr(self.distribution, attr)
|
||||
else:
|
||||
return myval
|
||||
else:
|
||||
|
@ -109,7 +109,7 @@ class Command:
|
|||
|
||||
def ensure_finalized (self):
|
||||
if not self.finalized:
|
||||
self.finalize_options ()
|
||||
self.finalize_options()
|
||||
self.finalized = 1
|
||||
|
||||
|
||||
|
@ -273,7 +273,7 @@ class Command:
|
|||
# -- Convenience methods for commands ------------------------------
|
||||
|
||||
def get_command_name (self):
|
||||
if hasattr (self, 'command_name'):
|
||||
if hasattr(self, 'command_name'):
|
||||
return self.command_name
|
||||
else:
|
||||
return self.__class__.__name__
|
||||
|
@ -296,12 +296,12 @@ class Command:
|
|||
|
||||
# Option_pairs: list of (src_option, dst_option) tuples
|
||||
|
||||
src_cmd_obj = self.distribution.get_command_obj (src_cmd)
|
||||
src_cmd_obj.ensure_finalized ()
|
||||
src_cmd_obj = self.distribution.get_command_obj(src_cmd)
|
||||
src_cmd_obj.ensure_finalized()
|
||||
for (src_option, dst_option) in option_pairs:
|
||||
if getattr (self, dst_option) is None:
|
||||
setattr (self, dst_option,
|
||||
getattr (src_cmd_obj, src_option))
|
||||
if getattr(self, dst_option) is None:
|
||||
setattr(self, dst_option,
|
||||
getattr(src_cmd_obj, src_option))
|
||||
|
||||
|
||||
def get_finalized_command (self, command, create=1):
|
||||
|
@ -310,8 +310,8 @@ class Command:
|
|||
'command', call its 'ensure_finalized()' method, and return the
|
||||
finalized command object.
|
||||
"""
|
||||
cmd_obj = self.distribution.get_command_obj (command, create)
|
||||
cmd_obj.ensure_finalized ()
|
||||
cmd_obj = self.distribution.get_command_obj(command, create)
|
||||
cmd_obj.ensure_finalized()
|
||||
return cmd_obj
|
||||
|
||||
# XXX rename to 'get_reinitialized_command()'? (should do the
|
||||
|
@ -325,7 +325,7 @@ class Command:
|
|||
Distribution, which creates and finalizes the command object if
|
||||
necessary and then invokes its 'run()' method.
|
||||
"""
|
||||
self.distribution.run_command (command)
|
||||
self.distribution.run_command(command)
|
||||
|
||||
|
||||
def get_sub_commands (self):
|
||||
|
@ -345,8 +345,8 @@ class Command:
|
|||
# -- External world manipulation -----------------------------------
|
||||
|
||||
def warn (self, msg):
|
||||
sys.stderr.write ("warning: %s: %s\n" %
|
||||
(self.get_command_name(), msg))
|
||||
sys.stderr.write("warning: %s: %s\n" %
|
||||
(self.get_command_name(), msg))
|
||||
|
||||
|
||||
def execute (self, func, args, msg=None, level=1):
|
||||
|
@ -389,17 +389,17 @@ class Command:
|
|||
|
||||
def move_file (self, src, dst, level=1):
|
||||
"""Move a file respecting verbose and dry-run flags."""
|
||||
return file_util.move_file (src, dst,
|
||||
self.verbose >= level,
|
||||
self.dry_run)
|
||||
return file_util.move_file(src, dst,
|
||||
self.verbose >= level,
|
||||
self.dry_run)
|
||||
|
||||
|
||||
def spawn (self, cmd, search_path=1, level=1):
|
||||
"""Spawn an external command respecting verbose and dry-run flags."""
|
||||
from distutils.spawn import spawn
|
||||
spawn (cmd, search_path,
|
||||
self.verbose >= level,
|
||||
self.dry_run)
|
||||
spawn(cmd, search_path,
|
||||
self.verbose >= level,
|
||||
self.dry_run)
|
||||
|
||||
|
||||
def make_archive (self, base_name, format,
|
||||
|
@ -421,15 +421,15 @@ class Command:
|
|||
"""
|
||||
if exec_msg is None:
|
||||
exec_msg = "generating %s from %s" % \
|
||||
(outfile, string.join (infiles, ', '))
|
||||
(outfile, string.join(infiles, ', '))
|
||||
if skip_msg is None:
|
||||
skip_msg = "skipping %s (inputs unchanged)" % outfile
|
||||
|
||||
|
||||
# Allow 'infiles' to be a single string
|
||||
if type (infiles) is StringType:
|
||||
if type(infiles) is StringType:
|
||||
infiles = (infiles,)
|
||||
elif type (infiles) not in (ListType, TupleType):
|
||||
elif type(infiles) not in (ListType, TupleType):
|
||||
raise TypeError, \
|
||||
"'infiles' must be a string, or a list or tuple of strings"
|
||||
|
||||
|
@ -437,11 +437,11 @@ class Command:
|
|||
# exist, is out-of-date, or the 'force' flag is true) then
|
||||
# perform the action that presumably regenerates it
|
||||
if self.force or dep_util.newer_group (infiles, outfile):
|
||||
self.execute (func, args, exec_msg, level)
|
||||
self.execute(func, args, exec_msg, level)
|
||||
|
||||
# Otherwise, print the "skip" message
|
||||
else:
|
||||
self.announce (skip_msg, level)
|
||||
self.announce(skip_msg, level)
|
||||
|
||||
# make_file ()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue