diff options
author | Greg Noel <GregNoel@tigris.org> | 2010-04-15 00:02:59 (GMT) |
---|---|---|
committer | Greg Noel <GregNoel@tigris.org> | 2010-04-15 00:02:59 (GMT) |
commit | 9931fe6c59d330d0dbeea1c51456e3a9f94377d8 (patch) | |
tree | 0e17c9808475e40bfad54db43529ad01d411e6c2 /src/engine/SCons/compat | |
parent | 12ec17eedc70ee82421b27ff7dd84e947d4e6953 (diff) | |
download | SCons-9931fe6c59d330d0dbeea1c51456e3a9f94377d8.zip SCons-9931fe6c59d330d0dbeea1c51456e3a9f94377d8.tar.gz SCons-9931fe6c59d330d0dbeea1c51456e3a9f94377d8.tar.bz2 |
http://scons.tigris.org/issues/show_bug.cgi?id=2345
Apply the first part of the 'raise' fixer (the three-argument cases are not
converted and will need to wait until native support of with_traceback() is
available).
Diffstat (limited to 'src/engine/SCons/compat')
-rw-r--r-- | src/engine/SCons/compat/__init__.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/compat/_scons_hashlib.py | 2 | ||||
-rw-r--r-- | src/engine/SCons/compat/_scons_optparse.py | 20 | ||||
-rw-r--r-- | src/engine/SCons/compat/_scons_sets.py | 8 | ||||
-rw-r--r-- | src/engine/SCons/compat/_scons_shlex.py | 4 |
5 files changed, 18 insertions, 18 deletions
diff --git a/src/engine/SCons/compat/__init__.py b/src/engine/SCons/compat/__init__.py index 1792dc4..a68ef72 100644 --- a/src/engine/SCons/compat/__init__.py +++ b/src/engine/SCons/compat/__init__.py @@ -308,7 +308,7 @@ except AttributeError: except OSError: if os.path.isdir(src): if shutil.destinsrc(src, dst): - raise Error, "Cannot move a directory '%s' into itself '%s'." % (src, dst) + raise Error("Cannot move a directory '%s' into itself '%s'." % (src, dst)) shutil.copytree(src, dst, symlinks=True) shutil.rmtree(src) else: diff --git a/src/engine/SCons/compat/_scons_hashlib.py b/src/engine/SCons/compat/_scons_hashlib.py index 66a3255..102304a7 100644 --- a/src/engine/SCons/compat/_scons_hashlib.py +++ b/src/engine/SCons/compat/_scons_hashlib.py @@ -42,7 +42,7 @@ class md5obj: def __init__(self, name, string=''): if not name in ('MD5', 'md5'): - raise ValueError, "unsupported hash type" + raise ValueError("unsupported hash type") self.name = 'md5' self.m = self.md5_module.md5() diff --git a/src/engine/SCons/compat/_scons_optparse.py b/src/engine/SCons/compat/_scons_optparse.py index 9c3df52..db6fd0d 100644 --- a/src/engine/SCons/compat/_scons_optparse.py +++ b/src/engine/SCons/compat/_scons_optparse.py @@ -257,10 +257,10 @@ class HelpFormatter: self.level = self.level - 1 def format_usage(self, usage): - raise NotImplementedError, "subclasses must implement" + raise NotImplementedError("subclasses must implement") def format_heading(self, heading): - raise NotImplementedError, "subclasses must implement" + raise NotImplementedError("subclasses must implement") def _format_text(self, text): """ @@ -831,7 +831,7 @@ class Option: parser.print_version() parser.exit() else: - raise RuntimeError, "unknown action %r" % self.action + raise RuntimeError("unknown action %r" % self.action) return 1 @@ -902,7 +902,7 @@ class Values: elif mode == "loose": self._update_loose(dict) else: - raise ValueError, "invalid update mode: %r" % mode + raise ValueError("invalid update mode: %r" % mode) def read_module(self, modname, mode="careful"): __import__(modname) @@ -981,7 +981,7 @@ class OptionContainer: def set_conflict_handler(self, handler): if handler not in ("error", "resolve"): - raise ValueError, "invalid conflict_resolution value %r" % handler + raise ValueError("invalid conflict_resolution value %r" % handler) self.conflict_handler = handler def set_description(self, description): @@ -1036,9 +1036,9 @@ class OptionContainer: elif len(args) == 1 and not kwargs: option = args[0] if not isinstance(option, Option): - raise TypeError, "not an Option instance: %r" % option + raise TypeError("not an Option instance: %r" % option) else: - raise TypeError, "invalid arguments" + raise TypeError("invalid arguments") self._check_conflict(option) @@ -1347,11 +1347,11 @@ class OptionParser (OptionContainer): elif len(args) == 1 and not kwargs: group = args[0] if not isinstance(group, OptionGroup): - raise TypeError, "not an OptionGroup instance: %r" % group + raise TypeError("not an OptionGroup instance: %r" % group) if group.parser is not self: - raise ValueError, "invalid OptionGroup (wrong parser)" + raise ValueError("invalid OptionGroup (wrong parser)") else: - raise TypeError, "invalid arguments" + raise TypeError("invalid arguments") self.option_groups.append(group) return group diff --git a/src/engine/SCons/compat/_scons_sets.py b/src/engine/SCons/compat/_scons_sets.py index 765867b..211ff16 100644 --- a/src/engine/SCons/compat/_scons_sets.py +++ b/src/engine/SCons/compat/_scons_sets.py @@ -91,7 +91,7 @@ class BaseSet(object): """This is an abstract class.""" # Don't call this from a concrete subclass! if self.__class__ is BaseSet: - raise TypeError, ("BaseSet is an abstract class. " + raise TypeError("BaseSet is an abstract class. " "Use Set or ImmutableSet.") # Standard protocols: __len__, __repr__, __str__, __iter__ @@ -130,7 +130,7 @@ class BaseSet(object): # case). def __cmp__(self, other): - raise TypeError, "can't compare sets using cmp()" + raise TypeError("can't compare sets using cmp()") # Equality comparisons using the underlying dicts. Mixed-type comparisons # are allowed here, where Set == z for non-Set z always returns False, @@ -341,7 +341,7 @@ class BaseSet(object): # Check that the other argument to a binary operation is also # a set, raising a TypeError otherwise. if not isinstance(other, BaseSet): - raise TypeError, "Binary operation only permitted between sets" + raise TypeError("Binary operation only permitted between sets") def _compute_hash(self): # Calculate hash code for a set by xor'ing the hash codes of @@ -439,7 +439,7 @@ class Set(BaseSet): def __hash__(self): """A Set cannot be hashed.""" # We inherit object.__hash__, so we must deny this explicitly - raise TypeError, "Can't hash a Set, only an ImmutableSet." + raise TypeError("Can't hash a Set, only an ImmutableSet.") # In-place union, intersection, differences. # Subtle: The xyz_update() functions deliberately return None, diff --git a/src/engine/SCons/compat/_scons_shlex.py b/src/engine/SCons/compat/_scons_shlex.py index dfca2c1..6ed39cf 100644 --- a/src/engine/SCons/compat/_scons_shlex.py +++ b/src/engine/SCons/compat/_scons_shlex.py @@ -196,7 +196,7 @@ class shlex: if self.debug >= 2: print "shlex: I see EOF in quotes state" # XXX what error should be raised here? - raise ValueError, "No closing quotation" + raise ValueError("No closing quotation") if nextchar == self.state: if not self.posix: self.token = self.token + nextchar @@ -215,7 +215,7 @@ class shlex: if self.debug >= 2: print "shlex: I see EOF in escape state" # XXX what error should be raised here? - raise ValueError, "No escaped character" + raise ValueError("No escaped character") # In posix shells, only the quote itself or the escape # character may be escaped within quotes. if escapedstate in self.quotes and \ |