[Python-checkins] CVS: distutils/distutils dist.py,1.29,1.30

Greg Ward python-dev@python.org
Fri, 23 Jun 2000 18:22:43 -0700


Update of /cvsroot/python/distutils/distutils
In directory slayer.i.sourceforge.net:/tmp/cvs-serv9823

Modified Files:
	dist.py 
Log Message:
More stylistic tweaks to the generic '--help-xxx' code.

Index: dist.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/dist.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -r1.29 -r1.30
*** dist.py	2000/06/24 00:23:20	1.29
--- dist.py	2000/06/24 01:22:41	1.30
***************
*** 444,448 ****
              help_options = fix_help_options(cmd_class.help_options)
          else:
!             help_optiosn = []
  
  
--- 444,448 ----
              help_options = fix_help_options(cmd_class.help_options)
          else:
!             help_options = []
  
  
***************
*** 450,454 ****
          # in 'global_options'.
          parser.set_option_table (self.global_options +
!                                  cmd_class.user_options + help_options)
          parser.set_negative_aliases (negative_opt)
          (args, opts) = parser.getopt (args[1:])
--- 450,455 ----
          # in 'global_options'.
          parser.set_option_table (self.global_options +
!                                  cmd_class.user_options +
!                                  help_options)
          parser.set_negative_aliases (negative_opt)
          (args, opts) = parser.getopt (args[1:])
***************
*** 460,476 ****
              type (cmd_class.help_options) is ListType):
  	    help_option_found=0
! 	    for help_option in cmd_class.help_options:
! 		if hasattr(opts, parser.get_attr_name(help_option[0])):
  		    help_option_found=1
  		    #print "showing help for option %s of command %s" % \
                      #      (help_option[0],cmd_class)
! 		    if callable(help_option[3]):
! 			help_option[3]()
! 		    else:
!         		raise DistutilsClassError, \
!                           ("command class %s must provide " +
!                            "a callable object for help_option '%s'") % \
!                           (cmd_class,help_option[0])
! 	    if help_option_found: 
  		return
  
--- 461,479 ----
              type (cmd_class.help_options) is ListType):
  	    help_option_found=0
! 	    for (help_option, short, desc, func) in cmd_class.help_options:
! 		if hasattr(opts, parser.get_attr_name(help_option)):
  		    help_option_found=1
  		    #print "showing help for option %s of command %s" % \
                      #      (help_option[0],cmd_class)
! 
!                     if callable(func):
! 			func()
!                     else:
!                         raise DistutilsClassError, \
!                             ("invalid help function %s for help option '%s': "
!                              "must be a callable object (function, etc.)") % \
!                             (`func`, help_option)
! 
!             if help_option_found: 
  		return