summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/command/bdist.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-06-07 03:00:06 (GMT)
committerGreg Ward <gward@python.net>2000-06-07 03:00:06 (GMT)
commit9d17a7ad6df0a940f8f10cf7a113aaffc4222309 (patch)
tree825174ee769bf6ab27252f9a2965ed2b81680fb5 /Lib/distutils/command/bdist.py
parent1169687692e5e897033421fe6a73a3c32675a7d7 (diff)
downloadcpython-9d17a7ad6df0a940f8f10cf7a113aaffc4222309.zip
cpython-9d17a7ad6df0a940f8f10cf7a113aaffc4222309.tar.gz
cpython-9d17a7ad6df0a940f8f10cf7a113aaffc4222309.tar.bz2
Patch from Rene Liebscher: this adds "--help-foo" options to list the
values that "--foo" can take for various commands: eg. what formats for "sdist" and "bdist", what compilers for "build_ext" and "build_clib". I have *not* reviewed this patch; I'm checking it in as-is because it also fixes a paper-bag-over-head bug in bdist.py, and because I won't have time to review it properly for several days: so someone else can test it for me, instead!
Diffstat (limited to 'Lib/distutils/command/bdist.py')
-rw-r--r--Lib/distutils/command/bdist.py37
1 files changed, 26 insertions, 11 deletions
diff --git a/Lib/distutils/command/bdist.py b/Lib/distutils/command/bdist.py
index 3cd1eb0..66ef113 100644
--- a/Lib/distutils/command/bdist.py
+++ b/Lib/distutils/command/bdist.py
@@ -21,8 +21,7 @@ class bdist (Command):
user_options = [('bdist-base=', 'b',
"temporary directory for creating built distributions"),
('formats=', None,
- "formats for distribution " +
- "(gztar, bztar, zip, rpm, ... )"),
+ "formats for distribution"),
]
# The following commands do not take a format option from bdist
@@ -33,12 +32,28 @@ class bdist (Command):
default_format = { 'posix': 'gztar',
'nt': 'zip', }
- format_command = { 'gztar': 'bdist_dumb',
- 'bztar': 'bdist_dumb',
- 'ztar': 'bdist_dumb',
- 'tar': 'bdist_dumb',
- 'rpm': 'bdist_rpm',
- 'zip': 'bdist_dumb', }
+ format_command = { 'gztar': ('bdist_dumb',"gzipped tar-file"),
+ 'bztar': ('bdist_dumb',"bzip2-ed tar-file"),
+ 'ztar': ('bdist_dumb',"compressed tar-file"),
+ 'tar': ('bdist_dumb',"tar-file"),
+ 'rpm': ('bdist_rpm',"rpm distribution"),
+ 'zip': ('bdist_dumb',"zip-file"),
+ }
+
+ # prints all possible arguments to --format
+ def show_formats():
+ from distutils.fancy_getopt import FancyGetopt
+ list_of_formats=[]
+ for format in bdist.format_command.keys():
+ list_of_formats.append(("formats="+format,None,bdist.format_command[format][1]))
+ list_of_formats.sort()
+ pretty_printer=FancyGetopt(list_of_formats)
+ pretty_printer.print_help("List of available distribution formats:")
+
+ help_options = [
+ ('help-formats', None,
+ "lists available distribution formats",show_formats),
+ ]
def initialize_options (self):
@@ -74,14 +89,14 @@ class bdist (Command):
for format in self.formats:
try:
- cmd_name = self.format_command[self.format]
+ cmd_name = self.format_command[format][0]
except KeyError:
raise DistutilsOptionError, \
- "invalid format '%s'" % self.format
+ "invalid format '%s'" % format
sub_cmd = self.reinitialize_command(cmd_name)
if cmd_name not in self.no_format_option:
- sub_cmd.format = self.format
+ sub_cmd.format = format
self.run_command (cmd_name)
# run()