diff options
author | Greg Ward <gward@python.net> | 2000-06-24 01:23:37 +0000 |
---|---|---|
committer | Greg Ward <gward@python.net> | 2000-06-24 01:23:37 +0000 |
commit | 3459381e2a271981e09441752962b748869adf5d (patch) | |
tree | fb12badb277c876627bbfbe2a2a1628941bb6234 /Lib/distutils/command/sdist.py | |
parent | 55fced3df9efac28e4ead6e3115a4e8658e28bf5 (diff) | |
download | cpython-git-3459381e2a271981e09441752962b748869adf5d.tar.gz |
Changed so all the help-generating functions are defined, at module-level,
in the module of the command classes that have command-specific
help options. This lets us keep the principle of lazily importing
the ccompiler module, and also gets away from defining non-methods
at class level.
Diffstat (limited to 'Lib/distutils/command/sdist.py')
-rw-r--r-- | Lib/distutils/command/sdist.py | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/Lib/distutils/command/sdist.py b/Lib/distutils/command/sdist.py index 93e53bbd66..5627ebb9e5 100644 --- a/Lib/distutils/command/sdist.py +++ b/Lib/distutils/command/sdist.py @@ -13,11 +13,27 @@ from glob import glob from distutils.core import Command from distutils.util import \ convert_path, create_tree, remove_tree, newer, write_file, \ - check_archive_formats, ARCHIVE_FORMATS + check_archive_formats from distutils.text_file import TextFile from distutils.errors import DistutilsExecError, DistutilsOptionError +def show_formats (): + """Print all possible values for the 'formats' option (used by + the "--help-formats" command-line option). + """ + from distutils.fancy_getopt import FancyGetopt + from distutils.archive_util import ARCHIVE_FORMATS + formats=[] + for format in ARCHIVE_FORMATS.keys(): + formats.append(("formats=" + format, None, + ARCHIVE_FORMATS[format][2])) + formats.sort() + pretty_printer = FancyGetopt(formats) + pretty_printer.print_help( + "List of available source distribution formats:") + + class sdist (Command): description = "create a source distribution (tarball, zip file, etc.)" @@ -43,22 +59,6 @@ class sdist (Command): ] - # XXX ugh: this has to precede the 'help_options' list, because - # it is mentioned there -- also, this is not a method, even though - # it's defined in a class: double-ugh! - def show_formats (): - """Print all possible values for the 'formats' option -- used by - the "--help-formats" command-line option. - """ - from distutils.fancy_getopt import FancyGetopt - formats=[] - for format in ARCHIVE_FORMATS.keys(): - formats.append(("formats="+format,None,ARCHIVE_FORMATS[format][2])) - formats.sort() - pretty_printer = FancyGetopt(formats) - pretty_printer.print_help( - "List of available source distribution formats:") - help_options = [ ('help-formats', None, "list available distribution formats", show_formats), @@ -69,7 +69,6 @@ class sdist (Command): default_format = { 'posix': 'gztar', 'nt': 'zip' } - def initialize_options (self): # 'template' and 'manifest' are, respectively, the names of # the manifest template and manifest file. |