summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/command/bdist_rpm.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-06-04 14:20:57 (GMT)
committerGreg Ward <gward@python.net>2000-06-04 14:20:57 (GMT)
commit4227dc1b1531a4d1532c693ac0c255e8412b50a1 (patch)
treee80e1b317d471c352ddc599d4d925eac41a22130 /Lib/distutils/command/bdist_rpm.py
parent6f980b59368c022fe7c1925e83f909dabf74e634 (diff)
downloadcpython-4227dc1b1531a4d1532c693ac0c255e8412b50a1.zip
cpython-4227dc1b1531a4d1532c693ac0c255e8412b50a1.tar.gz
cpython-4227dc1b1531a4d1532c693ac0c255e8412b50a1.tar.bz2
Removed the 'ensure_*' methods -- they're just too handy too keep in one
command class, so they're now in the Command base class.
Diffstat (limited to 'Lib/distutils/command/bdist_rpm.py')
-rw-r--r--Lib/distutils/command/bdist_rpm.py44
1 files changed, 1 insertions, 43 deletions
diff --git a/Lib/distutils/command/bdist_rpm.py b/Lib/distutils/command/bdist_rpm.py
index 9bce04c..4e7675e 100644
--- a/Lib/distutils/command/bdist_rpm.py
+++ b/Lib/distutils/command/bdist_rpm.py
@@ -7,7 +7,7 @@ distributions)."""
__revision__ = "$Id$"
-import os, string, re
+import os, string
from types import *
from distutils.core import Command, DEBUG
from distutils.util import get_platform, write_file
@@ -203,48 +203,6 @@ class bdist_rpm (Command):
# 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)
-
-
-
def run (self):
if DEBUG: