[Python-checkins] CVS: distutils/distutils/command bdist_rpm.py,1.9,1.10

Greg Ward python-dev@python.org
Sun, 4 Jun 2000 07:21:00 -0700


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

Modified Files:
	bdist_rpm.py 
Log Message:
Removed the 'ensure_*' methods -- they're just too handy too keep in one
command class, so they're now in the Command base class.

Index: bdist_rpm.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/command/bdist_rpm.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** bdist_rpm.py	2000/06/03 01:03:55	1.9
--- bdist_rpm.py	2000/06/04 14:20:57	1.10
***************
*** 6,12 ****
  # created 2000/04/25, by Harry Henry Gebel
  
! __revision__ = "$Id: bdist_rpm.py,v 1.9 2000/06/03 01:03:55 gward Exp $"
  
! import os, string, re
  from types import *
  from distutils.core import Command, DEBUG
--- 6,12 ----
  # created 2000/04/25, by Harry Henry Gebel
  
! __revision__ = "$Id: bdist_rpm.py,v 1.10 2000/06/04 14:20:57 gward Exp $"
  
! import os, string
  from types import *
  from distutils.core import Command, DEBUG
***************
*** 202,247 ****
  
      # finalize_package_data ()
- 
- 
-     # XXX these look awfully handy: should probably move them
-     # up to Command and use more widely.
-     def _ensure_stringlike (self, option, what, default=None):
-         val = getattr(self, option)
-         if val is None:
-             setattr(self, option, default)
-             return default
-         elif type(val) is not StringType:
-             raise DistutilsOptionError, \
-                   "'%s' must be a %s (got `%s`)" % (option, what, val)
-         return val
- 
-     def ensure_string (self, option, default=None):
-         self._ensure_stringlike(option, "string", default)
- 
-     def ensure_string_list (self, option):
-         val = getattr(self, option)
-         if val is None:
-             return
-         elif type(val) is StringType:
-             setattr(self, option, re.split(r',\s*|\s+', val))
-         else:
-             if type(val) is ListType:
-                 types = map(type, val)
-                 ok = (types == [StringType] * len(val))
-             else:
-                 ok = 0
- 
-             if not ok:
-                 raise DistutilsOptionError, \
-                       "'%s' must be a list of strings (got %s)" % \
-                       (option, `val`)
-         
-     def ensure_filename (self, option, default=None):
-         val = self._ensure_stringlike(option, "filename", None)
-         if val is not None and not os.path.exists(val):
-             raise DistutilsOptionError, \
-                   "error in '%s' option: file '%s' does not exist" % \
-                   (option, val)
- 
  
  
--- 202,205 ----