[Python-checkins] CVS: distutils/distutils cmd.py,1.6,1.7
Greg Ward
python-dev@python.org
Sun, 7 May 2000 11:29:21 -0400 (EDT)
Update of /projects/cvsroot/distutils/distutils
In directory newcnri:/tmp/cvs-serv27636
Modified Files:
cmd.py
Log Message:
Got rid of some little-used and not-very-useful methods: 'get_option()' and
'get_options()'.
Index: cmd.py
===================================================================
RCS file: /projects/cvsroot/distutils/distutils/cmd.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** cmd.py 2000/04/15 22:15:07 1.6
--- cmd.py 2000/05/07 15:29:15 1.7
***************
*** 7,11 ****
# (extricated from core.py; actually dates back to the beginning)
! __revision__ = "$Id: cmd.py,v 1.6 2000/04/15 22:15:07 gward Exp $"
import sys, string
--- 7,11 ----
# (extricated from core.py; actually dates back to the beginning)
! __revision__ = "$Id: cmd.py,v 1.7 2000/05/07 15:29:15 gward Exp $"
import sys, string
***************
*** 158,202 ****
- # -- Option query/set methods --------------------------------------
-
- def get_option (self, option):
- """Return the value of a single option for this command. Raise
- AttributeError if 'option' is not known."""
- return getattr (self, option)
-
-
- def get_options (self, *options):
- """Return (as a tuple) the values of several options for this
- command. Raise AttributeError if any of the options in
- 'options' are not known."""
-
- values = []
- for opt in options:
- values.append (getattr (self, opt))
-
- return tuple (values)
-
-
- def set_option (self, option, value):
- """Set the value of a single option for this command. Raise
- AttributeError if 'option' is not known."""
-
- if not hasattr (self, option):
- raise AttributeError, \
- "command '%s': no such option '%s'" % \
- (self.get_command_name(), option)
- if value is not None:
- setattr (self, option, value)
-
- def set_options (self, **optval):
- """Set the values of several options for this command. Raise
- AttributeError if any of the options specified as
- keyword arguments are not known."""
-
- for k in optval.keys():
- if optval[k] is not None:
- self.set_option (k, optval[k])
-
-
# -- Convenience methods for commands ------------------------------
--- 158,161 ----
***************
*** 229,234 ****
for (src_option, dst_option) in option_pairs:
if getattr (self, dst_option) is None:
! self.set_option (dst_option,
! src_cmd_obj.get_option (src_option))
--- 188,193 ----
for (src_option, dst_option) in option_pairs:
if getattr (self, dst_option) is None:
! setattr (self, dst_option,
! getattr (src_cmd_obj, src_option))
***************
*** 248,252 ****
cmd_obj = self.find_peer (command)
! return cmd_obj.get_option (option)
--- 207,211 ----
cmd_obj = self.find_peer (command)
! return getattr(cmd_obj, option)