mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
pep8-fied
This commit is contained in:
parent
2fdd0d5ab7
commit
eb6e0f583d
1 changed files with 23 additions and 42 deletions
|
@ -93,11 +93,7 @@ class Command:
|
||||||
# always calls 'finalize_options()', to respect/update it.
|
# always calls 'finalize_options()', to respect/update it.
|
||||||
self.finalized = 0
|
self.finalized = 0
|
||||||
|
|
||||||
# __init__ ()
|
|
||||||
|
|
||||||
|
|
||||||
# XXX A more explicit way to customize dry_run would be better.
|
# XXX A more explicit way to customize dry_run would be better.
|
||||||
|
|
||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
if attr == 'dry_run':
|
if attr == 'dry_run':
|
||||||
myval = getattr(self, "_" + attr)
|
myval = getattr(self, "_" + attr)
|
||||||
|
@ -108,13 +104,11 @@ class Command:
|
||||||
else:
|
else:
|
||||||
raise AttributeError, attr
|
raise AttributeError, attr
|
||||||
|
|
||||||
|
|
||||||
def ensure_finalized(self):
|
def ensure_finalized(self):
|
||||||
if not self.finalized:
|
if not self.finalized:
|
||||||
self.finalize_options()
|
self.finalize_options()
|
||||||
self.finalized = 1
|
self.finalized = 1
|
||||||
|
|
||||||
|
|
||||||
# Subclasses must define:
|
# Subclasses must define:
|
||||||
# initialize_options()
|
# initialize_options()
|
||||||
# provide default values for all options; may be customized by
|
# provide default values for all options; may be customized by
|
||||||
|
@ -180,7 +174,6 @@ class Command:
|
||||||
|
|
||||||
This method must be implemented by all command classes.
|
This method must be implemented by all command classes.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
raise RuntimeError, \
|
raise RuntimeError, \
|
||||||
"abstract method -- subclass %s must override" % self.__class__
|
"abstract method -- subclass %s must override" % self.__class__
|
||||||
|
|
||||||
|
@ -200,7 +193,6 @@ class Command:
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# -- Option validation methods -------------------------------------
|
# -- Option validation methods -------------------------------------
|
||||||
# (these are very handy in writing the 'finalize_options()' method)
|
# (these are very handy in writing the 'finalize_options()' method)
|
||||||
#
|
#
|
||||||
|
@ -285,7 +277,6 @@ class Command:
|
||||||
else:
|
else:
|
||||||
return self.__class__.__name__
|
return self.__class__.__name__
|
||||||
|
|
||||||
|
|
||||||
def set_undefined_options(self, src_cmd, *option_pairs):
|
def set_undefined_options(self, src_cmd, *option_pairs):
|
||||||
"""Set the values of any "undefined" options from corresponding
|
"""Set the values of any "undefined" options from corresponding
|
||||||
option values in some other command object. "Undefined" here means
|
option values in some other command object. "Undefined" here means
|
||||||
|
@ -334,7 +325,6 @@ class Command:
|
||||||
"""
|
"""
|
||||||
self.distribution.run_command(command)
|
self.distribution.run_command(command)
|
||||||
|
|
||||||
|
|
||||||
def get_sub_commands(self):
|
def get_sub_commands(self):
|
||||||
"""Determine the sub-commands that are relevant in the current
|
"""Determine the sub-commands that are relevant in the current
|
||||||
distribution (ie., that need to be run). This is based on the
|
distribution (ie., that need to be run). This is based on the
|
||||||
|
@ -358,11 +348,9 @@ class Command:
|
||||||
def execute(self, func, args, msg=None, level=1):
|
def execute(self, func, args, msg=None, level=1):
|
||||||
util.execute(func, args, msg, dry_run=self.dry_run)
|
util.execute(func, args, msg, dry_run=self.dry_run)
|
||||||
|
|
||||||
|
|
||||||
def mkpath(self, name, mode=0777):
|
def mkpath(self, name, mode=0777):
|
||||||
dir_util.mkpath(name, mode, dry_run=self.dry_run)
|
dir_util.mkpath(name, mode, dry_run=self.dry_run)
|
||||||
|
|
||||||
|
|
||||||
def copy_file(self, infile, outfile,
|
def copy_file(self, infile, outfile,
|
||||||
preserve_mode=1, preserve_times=1, link=None, level=1):
|
preserve_mode=1, preserve_times=1, link=None, level=1):
|
||||||
"""Copy a file respecting verbose, dry-run and force flags. (The
|
"""Copy a file respecting verbose, dry-run and force flags. (The
|
||||||
|
@ -376,7 +364,6 @@ class Command:
|
||||||
link,
|
link,
|
||||||
dry_run=self.dry_run)
|
dry_run=self.dry_run)
|
||||||
|
|
||||||
|
|
||||||
def copy_tree(self, infile, outfile,
|
def copy_tree(self, infile, outfile,
|
||||||
preserve_mode=1, preserve_times=1, preserve_symlinks=0,
|
preserve_mode=1, preserve_times=1, preserve_symlinks=0,
|
||||||
level=1):
|
level=1):
|
||||||
|
@ -403,7 +390,6 @@ class Command:
|
||||||
return archive_util.make_archive(
|
return archive_util.make_archive(
|
||||||
base_name, format, root_dir, base_dir, dry_run=self.dry_run)
|
base_name, format, root_dir, base_dir, dry_run=self.dry_run)
|
||||||
|
|
||||||
|
|
||||||
def make_file(self, infiles, outfile, func, args,
|
def make_file(self, infiles, outfile, func, args,
|
||||||
exec_msg=None, skip_msg=None, level=1):
|
exec_msg=None, skip_msg=None, level=1):
|
||||||
"""Special case of 'execute()' for operations that process one or
|
"""Special case of 'execute()' for operations that process one or
|
||||||
|
@ -438,11 +424,6 @@ class Command:
|
||||||
else:
|
else:
|
||||||
log.debug(skip_msg)
|
log.debug(skip_msg)
|
||||||
|
|
||||||
# make_file ()
|
|
||||||
|
|
||||||
# class Command
|
|
||||||
|
|
||||||
|
|
||||||
# XXX 'install_misc' class not currently used -- it was the base class for
|
# XXX 'install_misc' class not currently used -- it was the base class for
|
||||||
# both 'install_scripts' and 'install_data', but they outgrew it. It might
|
# both 'install_scripts' and 'install_data', but they outgrew it. It might
|
||||||
# still be useful for 'install_headers', though, so I'm keeping it around
|
# still be useful for 'install_headers', though, so I'm keeping it around
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue