diff options
author | Greg Ward <gward@python.net> | 2000-05-28 23:54:00 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2000-05-28 23:54:00 (GMT) |
commit | adda156a13c8555ea6f809bca8488d10d21dec62 (patch) | |
tree | de55a33e33cc8077dee90d884fdb7e5c85811313 /Lib/distutils/cmd.py | |
parent | c32d9a69527af6d2823650ea7674e207c975f090 (diff) | |
download | cpython-adda156a13c8555ea6f809bca8488d10d21dec62.zip cpython-adda156a13c8555ea6f809bca8488d10d21dec62.tar.gz cpython-adda156a13c8555ea6f809bca8488d10d21dec62.tar.bz2 |
Added 'dump_options()' for debugging output.
Diffstat (limited to 'Lib/distutils/cmd.py')
-rw-r--r-- | Lib/distutils/cmd.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/distutils/cmd.py b/Lib/distutils/cmd.py index c21ea03..f803389 100644 --- a/Lib/distutils/cmd.py +++ b/Lib/distutils/cmd.py @@ -135,6 +135,21 @@ class Command: raise RuntimeError, \ "abstract method -- subclass %s must override" % self.__class__ + + def dump_options (self, header=None, indent=""): + from distutils.fancy_getopt import longopt_xlate + if header is None: + header = "command options for '%s':" % self.get_command_name() + print indent + header + indent = indent + " " + for (option, _, _) in self.user_options: + option = string.translate(option, longopt_xlate) + if option[-1] == "=": + option = option[:-1] + value = getattr(self, option) + print indent + "%s = %s" % (option, value) + + def run (self): """A command's raison d'etre: carry out the action it exists to perform, controlled by the options initialized in |