[Python-checkins] python/dist/src/Lib optparse.py,1.8,1.9

gward at users.sourceforge.net gward at users.sourceforge.net
Sat Jul 31 18:15:47 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14464/Lib

Modified Files:
	optparse.py 
Log Message:
Upgrade optparse module and tests to Optik 1.5a1:
  * add expansion of default values in help text: the string
    "%default" in an option's help string is expanded to str() of
    that option's default value, or "none" if no default value.
  * bug #955889: option default values that happen to be strings are
    now processed in the same way as values from the command line; this
    allows generation of nicer help when using custom types.  Can
    be disabled with parser.set_process_default_values(False).
  * bug #960515: don't crash when generating help for callback
    options that specify 'type', but not 'dest' or 'metavar'.
  * feature #815264: change the default help format for short options
    that take an argument from e.g. "-oARG" to "-o ARG"; add
    set_short_opt_delimiter() and set_long_opt_delimiter() methods to
    HelpFormatter to allow (slight) customization of the formatting.
  * patch #736940: internationalize Optik: all built-in user-
    targeted literal strings are passed through gettext.gettext().  (If
    you want translations (.po files), they're not included with Python
    -- you'll find them in the Optik source distribution from
    http://optik.sourceforge.net/ .)
  * bug #878453: respect $COLUMNS environment variable for
    wrapping help output.
  * feature #988122: expand "%prog" in the 'description' passed
    to OptionParser, just like in the 'usage' and 'version' strings.
    (This is *not* done in the 'description' passed to OptionGroup.)


Index: optparse.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/optparse.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** optparse.py	1 Apr 2004 07:40:35 -0000	1.8
--- optparse.py	31 Jul 2004 16:15:44 -0000	1.9
***************
*** 17,27 ****
  # it is automatically generated from the Optik source code.
  
! __version__ = "1.4.1+"
  
  __all__ = ['Option',
             'SUPPRESS_HELP',
             'SUPPRESS_USAGE',
-            'STD_HELP_OPTION',
-            'STD_VERSION_OPTION',
             'Values',
[...1652 lines suppressed...]
  
***************
*** 1391,1398 ****
              return possibilities[0]
          elif not possibilities:
!             raise BadOptionError("no such option: %s" % s)
          else:
              # More than one possible completion: ambiguous prefix.
!             raise BadOptionError("ambiguous option: %s (%s?)"
                                   % (s, ", ".join(possibilities)))
  
--- 1549,1556 ----
              return possibilities[0]
          elif not possibilities:
!             raise BadOptionError(_("no such option: %s") % s)
          else:
              # More than one possible completion: ambiguous prefix.
!             raise BadOptionError(_("ambiguous option: %s (%s?)")
                                   % (s, ", ".join(possibilities)))
  



More information about the Python-checkins mailing list