summaryrefslogtreecommitdiff
path: root/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
commit869c587086b76265a98af7c65def177261b593cc (patch)
tree15f8d302e2ea9bd1aec64c1197d860a54682253d /command/bdist.py
parent4fc435d3e805645f360a11cb97bf4d3e93e5af17 (diff)
downloadpython-setuptools-git-869c587086b76265a98af7c65def177261b593cc.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 'command/bdist.py')
-rw-r--r--command/bdist.py38
1 files changed, 20 insertions, 18 deletions
diff --git a/command/bdist.py b/command/bdist.py
index 16469936..47d4cbc9 100644
--- a/command/bdist.py
+++ b/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):