summaryrefslogtreecommitdiff
path: root/Lib/distutils/command/bdist.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-06-24 01:23:37 +0000
committerGreg Ward <gward@python.net>2000-06-24 01:23:37 +0000
commit3459381e2a271981e09441752962b748869adf5d (patch)
treefb12badb277c876627bbfbe2a2a1628941bb6234 /Lib/distutils/command/bdist.py
parent55fced3df9efac28e4ead6e3115a4e8658e28bf5 (diff)
downloadcpython-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/bdist.py')
-rw-r--r--Lib/distutils/command/bdist.py38
1 files changed, 20 insertions, 18 deletions
diff --git a/Lib/distutils/command/bdist.py b/Lib/distutils/command/bdist.py
index 164699362d..47d4cbc965 100644
--- a/Lib/distutils/command/bdist.py
+++ b/Lib/distutils/command/bdist.py
@@ -14,6 +14,18 @@ from distutils.errors import *
from distutils.util import get_platform
+def show_formats ():
+ """Print list of available formats (arguments to "--format" option).
+ """
+ from distutils.fancy_getopt import FancyGetopt
+ formats=[]
+ for format in bdist.format_commands:
+ formats.append(("formats=" + format, None,
+ bdist.format_command[format][1]))
+ pretty_printer = FancyGetopt(formats)
+ pretty_printer.print_help("List of available distribution formats:")
+
+
class bdist (Command):
description = "create a built (binary) distribution"
@@ -24,6 +36,11 @@ class bdist (Command):
"formats for distribution (comma-separated list)"),
]
+ help_options = [
+ ('help-formats', None,
+ "lists available distribution formats", show_formats),
+ ]
+
# The following commands do not take a format option from bdist
no_format_option = ('bdist_rpm',)
@@ -38,24 +55,9 @@ class bdist (Command):
'ztar': ('bdist_dumb', "compressed tar file"),
'tar': ('bdist_dumb', "tar file"),
'zip': ('bdist_dumb', "ZIP file"),
- }
-
- def show_formats ():
- """Print list of available formats (arguments to "--format" option).
- """
- from distutils.fancy_getopt import FancyGetopt
- formats=[]
- for format in bdist.format_command.keys():
- formats.append(("formats="+format, None,
- bdist.format_command[format][1]))
- formats.sort()
- pretty_printer = FancyGetopt(formats)
- pretty_printer.print_help("List of available distribution formats:")
-
- help_options = [
- ('help-formats', None,
- "lists available distribution formats",show_formats),
- ]
+ }
+ # establish the preferred order
+ format_commands = ['rpm', 'gztar', 'bztar', 'ztar', 'tar', 'zip']
def initialize_options (self):