summaryrefslogtreecommitdiff
path: root/Lib/distutils/fancy_getopt.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>1999-08-14 23:44:37 +0000
committerGreg Ward <gward@python.net>1999-08-14 23:44:37 +0000
commit27d1b54cad9c3bb1408cd13308ffc94f70f87b44 (patch)
treed75a119d1d62373f30df3b9fa2dcb4376ec0dc08 /Lib/distutils/fancy_getopt.py
parent488da9b9d12213e5ed8c140cf51cd7b9b28de02d (diff)
downloadcpython-27d1b54cad9c3bb1408cd13308ffc94f70f87b44.tar.gz
Better detection of bad entries in option table.
Better error messages for bad entries in option table.
Diffstat (limited to 'Lib/distutils/fancy_getopt.py')
-rw-r--r--Lib/distutils/fancy_getopt.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/Lib/distutils/fancy_getopt.py b/Lib/distutils/fancy_getopt.py
index c63ce61b8e..125dceb3e1 100644
--- a/Lib/distutils/fancy_getopt.py
+++ b/Lib/distutils/fancy_getopt.py
@@ -47,16 +47,24 @@ def fancy_getopt (options, object, args):
attr_name = {}
takes_arg = {}
- for (long, short, help) in options:
+ for option in options:
+ try:
+ (long, short, help) = option
+ except ValueError:
+ raise DistutilsGetoptError, \
+ "invalid option tuple " + str (option)
+
# Type-check the option names
if type (long) is not StringType or len (long) < 2:
raise DistutilsGetoptError, \
- "long option must be a string of length >= 2"
+ "long option '%s' must be a string of length >= 2" % \
+ long
if (not ((short is None) or
(type (short) is StringType and len (short) == 1))):
raise DistutilsGetoptError, \
- "short option must be None or string of length 1"
+ "short option '%s' must be None or string of length 1" % \
+ short
long_opts.append (long)