http://scons.tigris.org/issues/show_bug.cgi?id=2345
authorgregnoel <gregnoel@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 15 Apr 2010 00:02:59 +0000 (00:02 +0000)
committergregnoel <gregnoel@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Thu, 15 Apr 2010 00:02:59 +0000 (00:02 +0000)
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).

git-svn-id: http://scons.tigris.org/svn/scons/trunk@4785 fdb21ef1-2011-0410-befe-b5e4ea1792b1

69 files changed:
QMTest/TestCmd.py
QMTest/TestSCons.py
QMTest/unittest.py
bench/dependency-func.py
bench/env.__setitem__.py
bin/xmlagenda.py
doc/man/scons.1
src/engine/SCons/Action.py
src/engine/SCons/ActionTests.py
src/engine/SCons/Builder.py
src/engine/SCons/BuilderTests.py
src/engine/SCons/CacheDir.py
src/engine/SCons/Defaults.py
src/engine/SCons/Environment.py
src/engine/SCons/EnvironmentTests.py
src/engine/SCons/ErrorsTests.py
src/engine/SCons/Executor.py
src/engine/SCons/ExecutorTests.py
src/engine/SCons/JobTests.py
src/engine/SCons/Memoize.py
src/engine/SCons/Node/FS.py
src/engine/SCons/Node/FSTests.py
src/engine/SCons/Node/NodeTests.py
src/engine/SCons/Node/__init__.py
src/engine/SCons/Platform/__init__.py
src/engine/SCons/SConf.py
src/engine/SCons/SConfTests.py
src/engine/SCons/SConsignTests.py
src/engine/SCons/Scanner/FortranTests.py
src/engine/SCons/Scanner/IDLTests.py
src/engine/SCons/Script/Main.py
src/engine/SCons/Script/SConsOptions.py
src/engine/SCons/Script/SConscript.py
src/engine/SCons/Subst.py
src/engine/SCons/SubstTests.py
src/engine/SCons/Taskmaster.py
src/engine/SCons/TaskmasterTests.py
src/engine/SCons/Tool/JavaCommon.py
src/engine/SCons/Tool/MSCommon/sdk.py
src/engine/SCons/Tool/MSCommon/vc.py
src/engine/SCons/Tool/MSCommon/vs.py
src/engine/SCons/Tool/PharLapCommon.py
src/engine/SCons/Tool/__init__.py
src/engine/SCons/Tool/install.py
src/engine/SCons/Tool/intelc.py
src/engine/SCons/Tool/mingw.py
src/engine/SCons/Tool/mslink.py
src/engine/SCons/Tool/msvc.py
src/engine/SCons/Tool/msvs.py
src/engine/SCons/Tool/mwld.py
src/engine/SCons/Tool/packaging/__init__.py
src/engine/SCons/Util.py
src/engine/SCons/UtilTests.py
src/engine/SCons/Variables/PathVariableTests.py
src/engine/SCons/Variables/__init__.py
src/engine/SCons/compat/__init__.py
src/engine/SCons/compat/_scons_hashlib.py
src/engine/SCons/compat/_scons_optparse.py
src/engine/SCons/compat/_scons_sets.py
src/engine/SCons/compat/_scons_shlex.py
src/engine/SCons/cpp.py
src/engine/SCons/dblite.py
test/Errors/InternalError.py
test/Errors/UserError.py
test/Scanner/exception.py
test/Script-import.py
test/Subst/AllowSubstExceptions.py
test/exceptions.py
test/option/debug-stacktrace.py

index 0139b297589f3886472d0ad08bd65217ba6f1f7c..6f53892841f85835b88854cc0aa0fc738cc6f644 100644 (file)
@@ -438,7 +438,7 @@ def match_re(lines = None, res = None):
             expr = re.compile(s)
         except re.error, e:
             msg = "Regular expression error in %s: %s"
             expr = re.compile(s)
         except re.error, e:
             msg = "Regular expression error in %s: %s"
-            raise re.error, msg % (repr(s), e[0])
+            raise re.error(msg % (repr(s), e[0]))
         if not expr.search(lines[i]):
             return
     return 1
         if not expr.search(lines[i]):
             return
     return 1
@@ -455,7 +455,7 @@ def match_re_dotall(lines = None, res = None):
         expr = re.compile(s, re.DOTALL)
     except re.error, e:
         msg = "Regular expression error in %s: %s"
         expr = re.compile(s, re.DOTALL)
     except re.error, e:
         msg = "Regular expression error in %s: %s"
-        raise re.error, msg % (repr(s), e[0])
+        raise re.error(msg % (repr(s), e[0]))
     if expr.match(lines):
         return 1
 
     if expr.match(lines):
         return 1
 
@@ -511,7 +511,7 @@ def diff_re(a, b, fromfile='', tofile='',
             expr = re.compile(s)
         except re.error, e:
             msg = "Regular expression error in %s: %s"
             expr = re.compile(s)
         except re.error, e:
             msg = "Regular expression error in %s: %s"
-            raise re.error, msg % (repr(s), e[0])
+            raise re.error(msg % (repr(s), e[0]))
         if not expr.search(bline):
             result.append("%sc%s" % (i+1, i+1))
             result.append('< ' + repr(a[i]))
         if not expr.search(bline):
             result.append("%sc%s" % (i+1, i+1))
             result.append('< ' + repr(a[i]))
@@ -1128,7 +1128,7 @@ class TestCmd(object):
         """
         file = self.canonicalize(file)
         if mode[0] != 'r':
         """
         file = self.canonicalize(file)
         if mode[0] != 'r':
-            raise ValueError, "mode must begin with 'r'"
+            raise ValueError("mode must begin with 'r'")
         return open(file, mode).read()
 
     def rmdir(self, dir):
         return open(file, mode).read()
 
     def rmdir(self, dir):
@@ -1586,7 +1586,7 @@ class TestCmd(object):
         """
         file = self.canonicalize(file)
         if mode[0] != 'w':
         """
         file = self.canonicalize(file)
         if mode[0] != 'w':
-            raise ValueError, "mode must begin with 'w'"
+            raise ValueError("mode must begin with 'w'")
         open(file, mode).write(content)
 
 # Local Variables:
         open(file, mode).write(content)
 
 # Local Variables:
index b7e019d5492531ad4f4f3c928d0dea0eff3ac9f2..d61c0089fe77b1f0ff4cccc379bd4520cfd0a937 100644 (file)
@@ -813,7 +813,7 @@ SConscript( sconscript )
         def matchPart(log, logfile, lastEnd, NoMatch=NoMatch):
             m = re.match(log, logfile[lastEnd:])
             if not m:
         def matchPart(log, logfile, lastEnd, NoMatch=NoMatch):
             m = re.match(log, logfile[lastEnd:])
             if not m:
-                raise NoMatch, lastEnd
+                raise NoMatch(lastEnd)
             return m.end() + lastEnd
         try:
             #print len(os.linesep)
             return m.end() + lastEnd
         try:
             #print len(os.linesep)
@@ -888,7 +888,7 @@ SConscript( sconscript )
                 log = ""
             if doCheckLog: lastEnd = matchPart(ls, logfile, lastEnd)
             if doCheckLog and lastEnd != len(logfile):
                 log = ""
             if doCheckLog: lastEnd = matchPart(ls, logfile, lastEnd)
             if doCheckLog and lastEnd != len(logfile):
-                raise NoMatch, lastEnd
+                raise NoMatch(lastEnd)
             
         except NoMatch, m:
             print "Cannot match log file against log regexp."
             
         except NoMatch, m:
             print "Cannot match log file against log regexp."
index 476c1fc18335bc0a87a192f45846e35e0e7ee691..1d87c1528cfa564e42d087272ecf77486ddfae0f 100644 (file)
@@ -124,8 +124,8 @@ class TestCase:
         try:
             self.__testMethod = getattr(self,methodName)
         except AttributeError:
         try:
             self.__testMethod = getattr(self,methodName)
         except AttributeError:
-            raise ValueError"no such test method in %s: %s" % \
-                  (self.__class__, methodName)
+            raise ValueError("no such test method in %s: %s" % \
+                  (self.__class__, methodName))
 
     def setUp(self):
         "Hook method for setting up the test fixture before exercising it."
 
     def setUp(self):
         "Hook method for setting up the test fixture before exercising it."
@@ -199,7 +199,7 @@ class TestCase:
            __debug__ is false.
         """
         if not expr:
            __debug__ is false.
         """
         if not expr:
-            raise AssertionError, msg
+            raise AssertionError(msg)
 
     failUnless = assert_
 
 
     failUnless = assert_
 
@@ -222,11 +222,11 @@ class TestCase:
         else:
             if hasattr(excClass,'__name__'): excName = excClass.__name__
             else: excName = str(excClass)
         else:
             if hasattr(excClass,'__name__'): excName = excClass.__name__
             else: excName = str(excClass)
-            raise AssertionError, excName
+            raise AssertionError(excName)
 
     def fail(self, msg=None):
         """Fail immediately, with the given message."""
 
     def fail(self, msg=None):
         """Fail immediately, with the given message."""
-        raise AssertionError, msg
+        raise AssertionError(msg)
                                    
     def __exc_info(self):
         """Return a version of sys.exc_info() with the traceback frame
                                    
     def __exc_info(self):
         """Return a version of sys.exc_info() with the traceback frame
@@ -376,7 +376,7 @@ def createTestInstance(name, module=None):
     """
           
     spec = name.split(':')
     """
           
     spec = name.split(':')
-    if len(spec) > 2: raise ValueError, "illegal test name: %s" % name
+    if len(spec) > 2: raise ValueError("illegal test name: %s" % name)
     if len(spec) == 1:
         testName = spec[0]
         caseName = None
     if len(spec) == 1:
         testName = spec[0]
         caseName = None
@@ -385,7 +385,7 @@ def createTestInstance(name, module=None):
     parts = testName.split('.')
     if module is None:
         if len(parts) < 2:
     parts = testName.split('.')
     if module is None:
         if len(parts) < 2:
-            raise ValueError, "incomplete test name: %s" % name
+            raise ValueError("incomplete test name: %s" % name)
         constructor = __import__('.'.join(parts[:-1]))
         parts = parts[1:]
     else:
         constructor = __import__('.'.join(parts[:-1]))
         parts = parts[1:]
     else:
@@ -393,20 +393,19 @@ def createTestInstance(name, module=None):
     for part in parts:
         constructor = getattr(constructor, part)
     if not callable(constructor):
     for part in parts:
         constructor = getattr(constructor, part)
     if not callable(constructor):
-        raise ValueError, "%s is not a callable object" % constructor
+        raise ValueError("%s is not a callable object" % constructor)
     if caseName:
         if caseName[-1] == '-':
             prefix = caseName[:-1]
             if not prefix:
     if caseName:
         if caseName[-1] == '-':
             prefix = caseName[:-1]
             if not prefix:
-                raise ValueError, "prefix too short: %s" % name
+                raise ValueError("prefix too short: %s" % name)
             test = makeSuite(constructor, prefix=prefix)
         else:
             test = constructor(caseName)
     else:
         test = constructor()
     if not hasattr(test,"countTestCases"):
             test = makeSuite(constructor, prefix=prefix)
         else:
             test = constructor(caseName)
     else:
         test = constructor()
     if not hasattr(test,"countTestCases"):
-        raise TypeError, \
-              "object %s found with spec %s is not a test" % (test, name)
+        raise TypeError("object %s found with spec %s is not a test" % (test, name))
     return test
 
 
     return test
 
 
@@ -662,7 +661,7 @@ Examples:
                 if opt in ('-h','-H','--help'):
                     self.usageExit()
             if len(args) == 0 and self.defaultTest is None:
                 if opt in ('-h','-H','--help'):
                     self.usageExit()
             if len(args) == 0 and self.defaultTest is None:
-                raise getopt.error, "No default test is defined."
+                raise getopt.error("No default test is defined.")
             if len(args) > 0:
                 self.testNames = args
             else:
             if len(args) > 0:
                 self.testNames = args
             else:
index beaa62664432b126e5ad59b0060af3b352ab00dd..7313cf97eb44a8ebff435ec147c8ca066a6beb4e 100644 (file)
@@ -26,7 +26,7 @@ def use_if_tests(env, dep, arg):
     elif t == '4444':
         func = dep.func4
     else:
     elif t == '4444':
         func = dep.func4
     else:
-        raise Exception, "bad key %s" % t
+        raise Exception("bad key %s" % t)
     return func(arg)
 
 
     return func(arg)
 
 
index 36a76727f2076f24bc489ed6e87b71b3a6b8302f..831a50718f4102b34ba1b790404ca04858dde5c2 100644 (file)
@@ -115,7 +115,7 @@ class env_Original(Environment):
             special(self, key, value)
         else:
             if not SCons.Environment.is_valid_construction_var(key):
             special(self, key, value)
         else:
             if not SCons.Environment.is_valid_construction_var(key):
-                raise SCons.Errors.UserError, "Illegal construction variable `%s'" % key
+                raise SCons.Errors.UserError("Illegal construction variable `%s'" % key)
             self._dict[key] = value
 
 class env_Global_is_valid(Environment):
             self._dict[key] = value
 
 class env_Global_is_valid(Environment):
@@ -126,7 +126,7 @@ class env_Global_is_valid(Environment):
             special(self, key, value)
         else:
             if not is_valid_construction_var(key):
             special(self, key, value)
         else:
             if not is_valid_construction_var(key):
-                raise SCons.Errors.UserError, "Illegal construction variable `%s'" % key
+                raise SCons.Errors.UserError("Illegal construction variable `%s'" % key)
             self._dict[key] = value
 
 class env_Method_is_valid(Environment):
             self._dict[key] = value
 
 class env_Method_is_valid(Environment):
@@ -143,7 +143,7 @@ class env_Method_is_valid(Environment):
             special(self, key, value)
         else:
             if not self.is_valid_construction_var(key):
             special(self, key, value)
         else:
             if not self.is_valid_construction_var(key):
-                raise SCons.Errors.UserError, "Illegal construction variable `%s'" % key
+                raise SCons.Errors.UserError("Illegal construction variable `%s'" % key)
             self._dict[key] = value
 
 class env_regex_attribute_is_valid(Environment):
             self._dict[key] = value
 
 class env_regex_attribute_is_valid(Environment):
@@ -154,7 +154,7 @@ class env_regex_attribute_is_valid(Environment):
             special(self, key, value)
         else:
             if not self._valid_var.match(key):
             special(self, key, value)
         else:
             if not self._valid_var.match(key):
-                raise SCons.Errors.UserError, "Illegal construction variable `%s'" % key
+                raise SCons.Errors.UserError("Illegal construction variable `%s'" % key)
             self._dict[key] = value
 
 class env_global_regex_is_valid(Environment):
             self._dict[key] = value
 
 class env_global_regex_is_valid(Environment):
@@ -165,7 +165,7 @@ class env_global_regex_is_valid(Environment):
             special(self, key, value)
         else:
             if not global_valid_var.match(key):
             special(self, key, value)
         else:
             if not global_valid_var.match(key):
-                raise SCons.Errors.UserError, "Illegal construction variable `%s'" % key
+                raise SCons.Errors.UserError("Illegal construction variable `%s'" % key)
             self._dict[key] = value
 
 class env_special_set_has_key(Environment):
             self._dict[key] = value
 
 class env_special_set_has_key(Environment):
@@ -175,7 +175,7 @@ class env_special_set_has_key(Environment):
             self._special_set[key](self, key, value)
         else:
             if not SCons.Environment.is_valid_construction_var(key):
             self._special_set[key](self, key, value)
         else:
             if not SCons.Environment.is_valid_construction_var(key):
-                raise SCons.Errors.UserError, "Illegal construction variable `%s'" % key
+                raise SCons.Errors.UserError("Illegal construction variable `%s'" % key)
             self._dict[key] = value
 
 class env_key_in_tuple(Environment):
             self._dict[key] = value
 
 class env_key_in_tuple(Environment):
@@ -185,7 +185,7 @@ class env_key_in_tuple(Environment):
             self._special_set[key](self, key, value)
         else:
             if not SCons.Environment.is_valid_construction_var(key):
             self._special_set[key](self, key, value)
         else:
             if not SCons.Environment.is_valid_construction_var(key):
-                raise SCons.Errors.UserError, "Illegal construction variable `%s'" % key
+                raise SCons.Errors.UserError("Illegal construction variable `%s'" % key)
             self._dict[key] = value
 
 class env_key_in_list(Environment):
             self._dict[key] = value
 
 class env_key_in_list(Environment):
@@ -195,7 +195,7 @@ class env_key_in_list(Environment):
             self._special_set[key](self, key, value)
         else:
             if not SCons.Environment.is_valid_construction_var(key):
             self._special_set[key](self, key, value)
         else:
             if not SCons.Environment.is_valid_construction_var(key):
-                raise SCons.Errors.UserError, "Illegal construction variable `%s'" % key
+                raise SCons.Errors.UserError("Illegal construction variable `%s'" % key)
             self._dict[key] = value
 
 class env_key_in_attribute(Environment):
             self._dict[key] = value
 
 class env_key_in_attribute(Environment):
@@ -205,7 +205,7 @@ class env_key_in_attribute(Environment):
             self._special_set[key](self, key, value)
         else:
             if not SCons.Environment.is_valid_construction_var(key):
             self._special_set[key](self, key, value)
         else:
             if not SCons.Environment.is_valid_construction_var(key):
-                raise SCons.Errors.UserError, "Illegal construction variable `%s'" % key
+                raise SCons.Errors.UserError("Illegal construction variable `%s'" % key)
             self._dict[key] = value
 
 class env_try_except(Environment):
             self._dict[key] = value
 
 class env_try_except(Environment):
@@ -219,7 +219,7 @@ class env_try_except(Environment):
                 self._dict[key]
             except KeyError:
                 if not SCons.Environment.is_valid_construction_var(key):
                 self._dict[key]
             except KeyError:
                 if not SCons.Environment.is_valid_construction_var(key):
-                    raise SCons.Errors.UserError, "Illegal construction variable `%s'" % key
+                    raise SCons.Errors.UserError("Illegal construction variable `%s'" % key)
             self._dict[key] = value
 
 class env_not_has_key(Environment):
             self._dict[key] = value
 
 class env_not_has_key(Environment):
@@ -231,7 +231,7 @@ class env_not_has_key(Environment):
         else:
             if key not in self._dict \
                 and not SCons.Environment.is_valid_construction_var(key):
         else:
             if key not in self._dict \
                 and not SCons.Environment.is_valid_construction_var(key):
-                    raise SCons.Errors.UserError, "Illegal construction variable `%s'" % key
+                    raise SCons.Errors.UserError("Illegal construction variable `%s'" % key)
             self._dict[key] = value
 
 class env_Best_attribute(Environment):
             self._dict[key] = value
 
 class env_Best_attribute(Environment):
@@ -242,7 +242,7 @@ class env_Best_attribute(Environment):
         else:
             if key not in self._dict \
                and not global_valid_var.match(key):
         else:
             if key not in self._dict \
                and not global_valid_var.match(key):
-                    raise SCons.Errors.UserError, "Illegal construction variable `%s'" % key
+                    raise SCons.Errors.UserError("Illegal construction variable `%s'" % key)
             self._dict[key] = value
 
 class env_Best_has_key(Environment):
             self._dict[key] = value
 
 class env_Best_has_key(Environment):
@@ -253,7 +253,7 @@ class env_Best_has_key(Environment):
         else:
             if key not in self._dict \
                and not global_valid_var.match(key):
         else:
             if key not in self._dict \
                and not global_valid_var.match(key):
-                    raise SCons.Errors.UserError, "Illegal construction variable `%s'" % key
+                    raise SCons.Errors.UserError("Illegal construction variable `%s'" % key)
             self._dict[key] = value
 
 class env_Best_list(Environment):
             self._dict[key] = value
 
 class env_Best_list(Environment):
@@ -264,7 +264,7 @@ class env_Best_list(Environment):
         else:
             if key not in self._dict \
                and not global_valid_var.match(key):
         else:
             if key not in self._dict \
                and not global_valid_var.match(key):
-                    raise SCons.Errors.UserError, "Illegal construction variable `%s'" % key
+                    raise SCons.Errors.UserError("Illegal construction variable `%s'" % key)
             self._dict[key] = value
 
 try:
             self._dict[key] = value
 
 try:
@@ -279,7 +279,7 @@ else:
                 self._special_set[key](self, key, value)
             else:
                 if not key.isalnum() and not global_valid_var.match(key):
                 self._special_set[key](self, key, value)
             else:
                 if not key.isalnum() and not global_valid_var.match(key):
-                    raise SCons.Errors.UserError, "Illegal construction variable `%s'" % key
+                    raise SCons.Errors.UserError("Illegal construction variable `%s'" % key)
                 self._dict[key] = value
 
 # We'll use the names of all the env_* classes we find later to build
                 self._dict[key] = value
 
 # We'll use the names of all the env_* classes we find later to build
index fb62f9a21c747293a2afb8057ab7defaf809693e..793733102c1a35ce0f787524c1650051948e495a 100755 (executable)
@@ -21,19 +21,19 @@ team = sorted('Steven Gary Greg Ken Jim David Bill Sergey Jason'.split())
 
 # The elements to be picked out of the issue
 PickList = [
 
 # The elements to be picked out of the issue
 PickList = [
-       # sort key -- these are used to sort the entry
-       'target_milestone', 'priority', 'votes_desc', 'creation_ts',
-       # payload -- these are displayed
-       'issue_id', 'votes', 'issue_type', 'target_milestone',
-       'priority', 'assigned_to', 'short_desc',
-       ]
+    # sort key -- these are used to sort the entry
+    'target_milestone', 'priority', 'votes_desc', 'creation_ts',
+    # payload -- these are displayed
+    'issue_id', 'votes', 'issue_type', 'target_milestone',
+    'priority', 'assigned_to', 'short_desc',
+    ]
 
 # Conbert a leaf element into its value as a text string
 # We assume it's "short enough" that there's only one substring
 def Value(element):
 
 # Conbert a leaf element into its value as a text string
 # We assume it's "short enough" that there's only one substring
 def Value(element):
-       v = element.firstChild
-       if v is None: return ''
-       return v.nodeValue
+    v = element.firstChild
+    if v is None: return ''
+    return v.nodeValue
 
 # Parse the XML issues file and produce a DOM for it
 import sys
 
 # Parse the XML issues file and produce a DOM for it
 import sys
@@ -46,26 +46,26 @@ xml = parse(xml)
 # and put them in our list of issues.
 issues = []
 for issuezilla in xml.childNodes:
 # and put them in our list of issues.
 issues = []
 for issuezilla in xml.childNodes:
-       # The Issuezilla element contains the issues
-       if issuezilla.nodeType != issuezilla.ELEMENT_NODE: continue
-       for issue in issuezilla.childNodes:
-               # The issue elements contain the info for an issue
-               if issue.nodeType != issue.ELEMENT_NODE: continue
-               # Accumulate the pieces we want to include
-               d = {}
-               for element in issue.childNodes:
-                       if element.nodeName in PickList:
-                               d[element.nodeName] = Value(element)
-               # convert 'votes' to numeric, ascending and descending
-               try:
-                       v = int('0' + d['votes'])
-               except KeyError:
-                       pass
-               else:
-                       d['votes_desc'] = -v
-                       d['votes'] = v
-               # Marshal the elements and add them to the list
-               issues.append([ d[ix] for ix in PickList ])
+    # The Issuezilla element contains the issues
+    if issuezilla.nodeType != issuezilla.ELEMENT_NODE: continue
+    for issue in issuezilla.childNodes:
+        # The issue elements contain the info for an issue
+        if issue.nodeType != issue.ELEMENT_NODE: continue
+        # Accumulate the pieces we want to include
+        d = {}
+        for element in issue.childNodes:
+            if element.nodeName in PickList:
+                d[element.nodeName] = Value(element)
+        # convert 'votes' to numeric, ascending and descending
+        try:
+            v = int('0' + d['votes'])
+        except KeyError:
+            pass
+        else:
+            d['votes_desc'] = -v
+            d['votes'] = v
+        # Marshal the elements and add them to the list
+        issues.append([ d[ix] for ix in PickList ])
 issues.sort()
 
 # Transcribe the issues into comma-separated values.
 issues.sort()
 
 # Transcribe the issues into comma-separated values.
@@ -74,16 +74,16 @@ import csv
 writer = csv.writer(open('editlist.csv', 'w'))
 # header
 writer.writerow(['ID', 'Votes', 'Type/Member', 'Milestone',
 writer = csv.writer(open('editlist.csv', 'w'))
 # header
 writer.writerow(['ID', 'Votes', 'Type/Member', 'Milestone',
-               'Pri', 'Owner', 'Summary/Comments'])
+        'Pri', 'Owner', 'Summary/Comments'])
 for issue in issues:
 for issue in issues:
-       row = issue[4:]         # strip off sort key
-       #row[0] = """=hyperlink("http://scons.tigris.org/issues/show_bug.cgi?id=%s","%s")""" % (row[0],row[0])
-       if row[3] == '-unspecified-': row[3] = 'triage'
-       writer.writerow(['','','','','','',''])
-       writer.writerow(row)
-       writer.writerow(['','','consensus','','','',''])
-       writer.writerow(['','','','','','',''])
-       for member in team: writer.writerow(['','',member,'','','',''])
+    row = issue[4:]        # strip off sort key
+    #row[0] = """=hyperlink("http://scons.tigris.org/issues/show_bug.cgi?id=%s","%s")""" % (row[0],row[0])
+    if row[3] == '-unspecified-': row[3] = 'triage'
+    writer.writerow(['','','','','','',''])
+    writer.writerow(row)
+    writer.writerow(['','','consensus','','','',''])
+    writer.writerow(['','','','','','',''])
+    for member in team: writer.writerow(['','',member,'','','',''])
 
 # Local Variables:
 # tab-width:4
 
 # Local Variables:
 # tab-width:4
index 9c5e5de1514a854865391ded2e9e9943332836d2..3a47547e873942c1ef34ccc13a43fca80760af6f 100644 (file)
@@ -7393,7 +7393,7 @@ vars.Add('CC', 'The C compiler')
 
 def validate_color(key, val, env):
     if not val in ['red', 'blue', 'yellow']:
 
 def validate_color(key, val, env):
     if not val in ['red', 'blue', 'yellow']:
-        raise "Invalid color value '%s'" % val
+        raise Exception("Invalid color value '%s'" % val)
 vars.Add('COLOR', validator=valid_color)
 .EE
 
 vars.Add('COLOR', validator=valid_color)
 .EE
 
index ff67b490ee8aecdaaa89d7363db1a17dbac613a8..6b04612603bf672006f1d800039156d62f647c1b 100644 (file)
@@ -302,7 +302,7 @@ def _actionAppend(act1, act2):
     a1 = Action(act1)
     a2 = Action(act2)
     if a1 is None or a2 is None:
     a1 = Action(act1)
     a2 = Action(act2)
     if a1 is None or a2 is None:
-        raise TypeError, "Cannot append %s to %s" % (type(act1), type(act2))
+        raise TypeError("Cannot append %s to %s" % (type(act1), type(act2)))
     if isinstance(a1, ListAction):
         if isinstance(a2, ListAction):
             return ListAction(a1.list + a2.list)
     if isinstance(a1, ListAction):
         if isinstance(a2, ListAction):
             return ListAction(a1.list + a2.list)
@@ -691,8 +691,8 @@ class CommandAction(_ActionAction):
         _ActionAction.__init__(self, **kw)
         if is_List(cmd):
             if list(filter(is_List, cmd)):
         _ActionAction.__init__(self, **kw)
         if is_List(cmd):
             if list(filter(is_List, cmd)):
-                raise TypeError"CommandAction should be given only " \
-                      "a single command"
+                raise TypeError("CommandAction should be given only " \
+                      "a single command")
         self.cmd_list = cmd
 
     def __str__(self):
         self.cmd_list = cmd
 
     def __str__(self):
index 4cb5a0ab40c6cbc963be608cab73ac4424dad5b0..4ffbdecf2b375637468d647d1e9519c64071379c 100644 (file)
@@ -275,7 +275,7 @@ def test_positional_args(pos_callback, cmd, **kw):
             m = 'Invalid command display variable'
             assert s.find(m) != -1, 'Unexpected string:  %s' % s
         else:
             m = 'Invalid command display variable'
             assert s.find(m) != -1, 'Unexpected string:  %s' % s
         else:
-            raise Exception, "did not catch expected UserError"
+            raise Exception("did not catch expected UserError")
 
     return act
 
 
     return act
 
@@ -494,7 +494,7 @@ class _ActionActionTestCase(unittest.TestCase):
             m = 'Cannot have both strfunction and cmdstr args to Action()'
             assert s.find(m) != -1, 'Unexpected string:  %s' % s
         else:
             m = 'Cannot have both strfunction and cmdstr args to Action()'
             assert s.find(m) != -1, 'Unexpected string:  %s' % s
         else:
-            raise Exception, "did not catch expected UserError"
+            raise Exception("did not catch expected UserError")
 
     def test___cmp__(self):
         """Test Action comparison
 
     def test___cmp__(self):
         """Test Action comparison
index 4cce92f9f47dccd774a95146cc8b1290dff05e51..bbf503c07d7b22f31a41ac40e1d442b7ca57d049 100644 (file)
@@ -244,7 +244,7 @@ def Builder(**kw):
     composite = None
     if 'generator' in kw:
         if 'action' in kw:
     composite = None
     if 'generator' in kw:
         if 'action' in kw:
-            raise UserError, "You must not specify both an action and a generator."
+            raise UserError("You must not specify both an action and a generator.")
         kw['action'] = SCons.Action.CommandGeneratorAction(kw['generator'], {})
         del kw['generator']
     elif 'action' in kw:
         kw['action'] = SCons.Action.CommandGeneratorAction(kw['generator'], {})
         del kw['generator']
     elif 'action' in kw:
@@ -267,7 +267,7 @@ def Builder(**kw):
             # a callable to use as the actual emitter.
             var = SCons.Util.get_environment_var(emitter)
             if not var:
             # a callable to use as the actual emitter.
             var = SCons.Util.get_environment_var(emitter)
             if not var:
-                raise UserError, "Supplied emitter '%s' does not appear to refer to an Environment variable" % emitter
+                raise UserError("Supplied emitter '%s' does not appear to refer to an Environment variable" % emitter)
             kw['emitter'] = EmitterProxy(var)
         elif SCons.Util.is_Dict(emitter):
             kw['emitter'] = DictEmitter(emitter)
             kw['emitter'] = EmitterProxy(var)
         elif SCons.Util.is_Dict(emitter):
             kw['emitter'] = DictEmitter(emitter)
@@ -291,7 +291,7 @@ def _node_errors(builder, env, tlist, slist):
     # were specified.
     for t in tlist:
         if t.side_effect:
     # were specified.
     for t in tlist:
         if t.side_effect:
-            raise UserError, "Multiple ways to build the same target were specified for: %s" % t
+            raise UserError("Multiple ways to build the same target were specified for: %s" % t)
         if t.has_explicit_builder():
             if not t.env is None and not t.env is env:
                 action = t.builder.action
         if t.has_explicit_builder():
             if not t.env is None and not t.env is env:
                 action = t.builder.action
@@ -303,22 +303,22 @@ def _node_errors(builder, env, tlist, slist):
                     SCons.Warnings.warn(SCons.Warnings.DuplicateEnvironmentWarning, msg)
                 else:
                     msg = "Two environments with different actions were specified for the same target: %s" % t
                     SCons.Warnings.warn(SCons.Warnings.DuplicateEnvironmentWarning, msg)
                 else:
                     msg = "Two environments with different actions were specified for the same target: %s" % t
-                    raise UserError, msg
+                    raise UserError(msg)
             if builder.multi:
                 if t.builder != builder:
                     msg = "Two different builders (%s and %s) were specified for the same target: %s" % (t.builder.get_name(env), builder.get_name(env), t)
             if builder.multi:
                 if t.builder != builder:
                     msg = "Two different builders (%s and %s) were specified for the same target: %s" % (t.builder.get_name(env), builder.get_name(env), t)
-                    raise UserError, msg
+                    raise UserError(msg)
                 # TODO(batch):  list constructed each time!
                 if t.get_executor().get_all_targets() != tlist:
                     msg = "Two different target lists have a target in common: %s  (from %s and from %s)" % (t, list(map(str, t.get_executor().get_all_targets())), list(map(str, tlist)))
                 # TODO(batch):  list constructed each time!
                 if t.get_executor().get_all_targets() != tlist:
                     msg = "Two different target lists have a target in common: %s  (from %s and from %s)" % (t, list(map(str, t.get_executor().get_all_targets())), list(map(str, tlist)))
-                    raise UserError, msg
+                    raise UserError(msg)
             elif t.sources != slist:
                 msg = "Multiple ways to build the same target were specified for: %s  (from %s and from %s)" % (t, list(map(str, t.sources)), list(map(str, slist)))
             elif t.sources != slist:
                 msg = "Multiple ways to build the same target were specified for: %s  (from %s and from %s)" % (t, list(map(str, t.sources)), list(map(str, slist)))
-                raise UserError, msg
+                raise UserError(msg)
 
     if builder.single_source:
         if len(slist) > 1:
 
     if builder.single_source:
         if len(slist) > 1:
-            raise UserError, "More than one source given for single-source builder: targets=%s sources=%s" % (list(map(str,tlist)), list(map(str,slist)))
+            raise UserError("More than one source given for single-source builder: targets=%s sources=%s" % (list(map(str,tlist)), list(map(str,slist))))
 
 class EmitterProxy:
     """This is a callable class that can act as a
 
 class EmitterProxy:
     """This is a callable class that can act as a
@@ -429,7 +429,7 @@ class BuilderBase:
         self.src_builder = src_builder
 
     def __nonzero__(self):
         self.src_builder = src_builder
 
     def __nonzero__(self):
-        raise InternalError, "Do not test for the Node.builder attribute directly; use Node.has_builder() instead"
+        raise InternalError("Do not test for the Node.builder attribute directly; use Node.has_builder() instead")
 
     def get_name(self, env):
         """Attempts to get the name of the Builder.
 
     def get_name(self, env):
         """Attempts to get the name of the Builder.
@@ -575,8 +575,8 @@ class BuilderBase:
         if executor is None:
             if not self.action:
                 fmt = "Builder %s must have an action to build %s."
         if executor is None:
             if not self.action:
                 fmt = "Builder %s must have an action to build %s."
-                raise UserErrorfmt % (self.get_name(env or self.env),
-                                        list(map(str,tlist)))
+                raise UserError(fmt % (self.get_name(env or self.env),
+                                        list(map(str,tlist))))
             key = self.action.batch_key(env or self.env, tlist, slist)
             if key:
                 try:
             key = self.action.batch_key(env or self.env, tlist, slist)
             if key:
                 try:
index 38eb0cacf65818cbabbfb67625db3fd04b4cd15b..50cf778839e3245c8395337277e7fdc55206cb9f 100644 (file)
@@ -344,7 +344,7 @@ class BuilderTestCase(unittest.TestCase):
         except SCons.Errors.UserError, e:
             pass
         else:
         except SCons.Errors.UserError, e:
             pass
         else:
-            raise "Did not catch expected UserError."
+            raise Exception("Did not catch expected UserError.")
 
         builder = SCons.Builder.Builder(action="foo")
         target = builder(env, None, source='n22', srcdir='src_dir')[0]
 
         builder = SCons.Builder.Builder(action="foo")
         target = builder(env, None, source='n22', srcdir='src_dir')[0]
index d585888a0edd6a53a6f03ca9b992661747682093..3ccfe7f880d5fde8741db81f11cf5d60c45d2534 100644 (file)
@@ -100,7 +100,7 @@ def CachePushFunc(target, source, env):
             # has beaten us creating the directory.
             if not fs.isdir(cachedir):
                 msg = errfmt % (str(target), cachefile)
             # has beaten us creating the directory.
             if not fs.isdir(cachedir):
                 msg = errfmt % (str(target), cachefile)
-                raise SCons.Errors.EnvironmentError, msg
+                raise SCons.Errors.EnvironmentError(msg)
 
     try:
         if fs.islink(t.path):
 
     try:
         if fs.islink(t.path):
index f532354dcf98670a17a8ae58dd26043e59d21725..cc2e0a00bdbbe4ab810c8f22fc456758ba77551c 100644 (file)
@@ -118,7 +118,7 @@ def SharedFlagChecker(source, target, env):
             except AttributeError:
                 shared = None
             if not shared:
             except AttributeError:
                 shared = None
             if not shared:
-                raise SCons.Errors.UserError, "Source file: %s is static and is not compatible with shared target: %s" % (src, target[0])
+                raise SCons.Errors.UserError("Source file: %s is static and is not compatible with shared target: %s" % (src, target[0]))
 
 SharedCheck = SCons.Action.Action(SharedFlagChecker, None)
 
 
 SharedCheck = SCons.Action.Action(SharedFlagChecker, None)
 
index 5449669e08d1b7553040bc80ff9c7386e97ef509..cd637bb2cfb55e97050ced97e7a70ea2b4ca746a 100644 (file)
@@ -271,7 +271,7 @@ class BuilderWrapper(MethodWrapper):
         elif name == 'builder':
             return self.method
         else:
         elif name == 'builder':
             return self.method
         else:
-            raise AttributeError, name
+            raise AttributeError(name)
 
     def __setattr__(self, name, value):
         if name == 'env':
 
     def __setattr__(self, name, value):
         if name == 'env':
@@ -432,7 +432,7 @@ class SubstitutionEnvironment:
             # efficient than calling another function or a method.
             if key not in self._dict \
                and not _is_valid_var.match(key):
             # efficient than calling another function or a method.
             if key not in self._dict \
                and not _is_valid_var.match(key):
-                    raise SCons.Errors.UserError, "Illegal construction variable `%s'" % key
+                    raise SCons.Errors.UserError("Illegal construction variable `%s'" % key)
             self._dict[key] = value
 
     def get(self, key, default=None):
             self._dict[key] = value
 
     def get(self, key, default=None):
@@ -1382,7 +1382,7 @@ class Base(SubstitutionEnvironment):
         copy_function = self._copy2_from_cache
         if function in ('MD5', 'content'):
             if not SCons.Util.md5:
         copy_function = self._copy2_from_cache
         if function in ('MD5', 'content'):
             if not SCons.Util.md5:
-                raise UserError, "MD5 signatures are not available in this version of Python."
+                raise UserError("MD5 signatures are not available in this version of Python.")
             function = self._changed_content
         elif function == 'MD5-timestamp':
             function = self._changed_timestamp_then_content
             function = self._changed_content
         elif function == 'MD5-timestamp':
             function = self._changed_timestamp_then_content
@@ -1392,7 +1392,7 @@ class Base(SubstitutionEnvironment):
         elif function == 'timestamp-match':
             function = self._changed_timestamp_match
         elif not callable(function):
         elif function == 'timestamp-match':
             function = self._changed_timestamp_match
         elif not callable(function):
-            raise UserError, "Unknown Decider value %s" % repr(function)
+            raise UserError("Unknown Decider value %s" % repr(function))
 
         # We don't use AddMethod because we don't want to turn the
         # function, which only expects three arguments, into a bound
 
         # We don't use AddMethod because we don't want to turn the
         # function, which only expects three arguments, into a bound
@@ -2049,7 +2049,7 @@ class Base(SubstitutionEnvironment):
 
         for side_effect in side_effects:
             if side_effect.multiple_side_effect_has_builder():
 
         for side_effect in side_effects:
             if side_effect.multiple_side_effect_has_builder():
-                raise SCons.Errors.UserError, "Multiple ways to build the same target were specified for: %s" % str(side_effect)
+                raise SCons.Errors.UserError("Multiple ways to build the same target were specified for: %s" % str(side_effect))
             side_effect.add_source(targets)
             side_effect.side_effect = 1
             self.Precious(side_effect)
             side_effect.add_source(targets)
             side_effect.side_effect = 1
             self.Precious(side_effect)
@@ -2075,12 +2075,12 @@ class Base(SubstitutionEnvironment):
         self.src_sig_type = type
         if type == 'MD5':
             if not SCons.Util.md5:
         self.src_sig_type = type
         if type == 'MD5':
             if not SCons.Util.md5:
-                raise UserError, "MD5 signatures are not available in this version of Python."
+                raise UserError("MD5 signatures are not available in this version of Python.")
             self.decide_source = self._changed_content
         elif type == 'timestamp':
             self.decide_source = self._changed_timestamp_match
         else:
             self.decide_source = self._changed_content
         elif type == 'timestamp':
             self.decide_source = self._changed_timestamp_match
         else:
-            raise UserError, "Unknown source signature type '%s'" % type
+            raise UserError("Unknown source signature type '%s'" % type)
 
     def Split(self, arg):
         """This function converts a string or list into a list of strings
 
     def Split(self, arg):
         """This function converts a string or list into a list of strings
@@ -2111,7 +2111,7 @@ class Base(SubstitutionEnvironment):
         self.tgt_sig_type = type
         if type in ('MD5', 'content'):
             if not SCons.Util.md5:
         self.tgt_sig_type = type
         if type in ('MD5', 'content'):
             if not SCons.Util.md5:
-                raise UserError, "MD5 signatures are not available in this version of Python."
+                raise UserError("MD5 signatures are not available in this version of Python.")
             self.decide_target = self._changed_content
         elif type == 'timestamp':
             self.decide_target = self._changed_timestamp_match
             self.decide_target = self._changed_content
         elif type == 'timestamp':
             self.decide_target = self._changed_timestamp_match
@@ -2120,7 +2120,7 @@ class Base(SubstitutionEnvironment):
         elif type == 'source':
             self.decide_target = self._changed_source
         else:
         elif type == 'source':
             self.decide_target = self._changed_source
         else:
-            raise UserError, "Unknown target signature type '%s'"%type
+            raise UserError("Unknown target signature type '%s'"%type)
 
     def Value(self, value, built_value=None):
         """
 
     def Value(self, value, built_value=None):
         """
@@ -2209,7 +2209,7 @@ class OverrideEnvironment(Base):
             return self.__dict__['__subject'].__getitem__(key)
     def __setitem__(self, key, value):
         if not is_valid_construction_var(key):
             return self.__dict__['__subject'].__getitem__(key)
     def __setitem__(self, key, value):
         if not is_valid_construction_var(key):
-            raise SCons.Errors.UserError, "Illegal construction variable `%s'" % key
+            raise SCons.Errors.UserError("Illegal construction variable `%s'" % key)
         self.__dict__['overrides'][key] = value
     def __delitem__(self, key):
         try:
         self.__dict__['overrides'][key] = value
     def __delitem__(self, key):
         try:
index 0719853b3a402064ea2d06321c8ae6b3b5004ddc..9f0e167e1e870d263c40c9fc848ed307c2012294 100644 (file)
@@ -1610,7 +1610,7 @@ def exists(env):
             def __str__(self):
                 return self.name
             def __cmp__(self, other):
             def __str__(self):
                 return self.name
             def __cmp__(self, other):
-                raise "should not compare"
+                raise Exception("should not compare")
 
         ccc = C('ccc')
 
 
         ccc = C('ccc')
 
index 1eee6e1b660b90eba90a78c952c312423588665b..9c8b925f7109eefce768eb3ee92dd4d56f170bb7 100644 (file)
@@ -79,21 +79,21 @@ class ErrorsTestCase(unittest.TestCase):
     def test_InternalError(self):
         """Test the InternalError exception."""
         try:
     def test_InternalError(self):
         """Test the InternalError exception."""
         try:
-            raise SCons.Errors.InternalError, "test internal error"
+            raise SCons.Errors.InternalError("test internal error")
         except SCons.Errors.InternalError, e:
             assert e.args == ("test internal error",)
 
     def test_UserError(self):
         """Test the UserError exception."""
         try:
         except SCons.Errors.InternalError, e:
             assert e.args == ("test internal error",)
 
     def test_UserError(self):
         """Test the UserError exception."""
         try:
-            raise SCons.Errors.UserError, "test user error"
+            raise SCons.Errors.UserError("test user error")
         except SCons.Errors.UserError, e:
             assert e.args == ("test user error",)
 
     def test_ExplicitExit(self):
         """Test the ExplicitExit exception."""
         try:
         except SCons.Errors.UserError, e:
             assert e.args == ("test user error",)
 
     def test_ExplicitExit(self):
         """Test the ExplicitExit exception."""
         try:
-            raise SCons.Errors.ExplicitExit, "node"
+            raise SCons.Errors.ExplicitExit("node")
         except SCons.Errors.ExplicitExit, e:
             assert e.node == "node"
 
         except SCons.Errors.ExplicitExit, e:
             assert e.node == "node"
 
index 8f9b917d9c9420edd7dc5457b51a9feb520fce26..feedf57933c00e436e65e123f45858fabced0051 100644 (file)
@@ -226,7 +226,7 @@ class Executor:
         if not SCons.Util.is_List(action):
             if not action:
                 import SCons.Errors
         if not SCons.Util.is_List(action):
             if not action:
                 import SCons.Errors
-                raise SCons.Errors.UserError, "Executor must have an action."
+                raise SCons.Errors.UserError("Executor must have an action.")
             action = [action]
         self.action_list = action
 
             action = [action]
         self.action_list = action
 
@@ -394,7 +394,7 @@ class Executor:
         for s in self.get_all_sources():
             if s.missing():
                 msg = "Source `%s' not found, needed by target `%s'."
         for s in self.get_all_sources():
             if s.missing():
                 msg = "Source `%s' not found, needed by target `%s'."
-                raise SCons.Errors.StopError, msg % (s, self.batches[0].targets[0])
+                raise SCons.Errors.StopError(msg % (s, self.batches[0].targets[0]))
 
     def add_pre_action(self, action):
         self.pre_actions.append(action)
 
     def add_pre_action(self, action):
         self.pre_actions.append(action)
index aaafa0704550a5403ec7b400b8f75989c874997d..8e067426fbe7d6c5000f577d4af3f338cf4daaad 100644 (file)
@@ -119,7 +119,7 @@ class ExecutorTestCase(unittest.TestCase):
         except SCons.Errors.UserError:
             pass
         else:
         except SCons.Errors.UserError:
             pass
         else:
-            raise "Did not catch expected UserError"
+            raise Exception("Did not catch expected UserError")
 
     def test__action_list(self):
         """Test the {get,set}_action_list() methods"""
 
     def test__action_list(self):
         """Test the {get,set}_action_list() methods"""
@@ -242,7 +242,7 @@ class ExecutorTestCase(unittest.TestCase):
         except SCons.Errors.BuildError:
             pass
         else:
         except SCons.Errors.BuildError:
             pass
         else:
-            raise Exception, "Did not catch expected BuildError"
+            raise Exception("Did not catch expected BuildError")
         assert result == ['pre_err'], result
         del result[:]
 
         assert result == ['pre_err'], result
         del result[:]
 
@@ -310,7 +310,7 @@ class ExecutorTestCase(unittest.TestCase):
         except SCons.Errors.StopError, e:
             assert str(e) == "Source `s2' not found, needed by target `t1'.", e
         else:
         except SCons.Errors.StopError, e:
             assert str(e) == "Source `s2' not found, needed by target `t1'.", e
         else:
-            raise AssertionError, "did not catch expected StopError: %s" % r
+            raise AssertionError("did not catch expected StopError: %s" % r)
 
     def test_add_pre_action(self):
         """Test adding pre-actions to an Executor"""
 
     def test_add_pre_action(self):
         """Test adding pre-actions to an Executor"""
index 85708ad1f701ce74e46c5c75745bc8e9c9c650f9..6e39d4bc413193d958c9bdaaf2dc9aea7b0b59f3 100644 (file)
@@ -398,7 +398,7 @@ class badnode (goodnode):
         goodnode.__init__(self)
         self.expect_to_be = SCons.Node.failed
     def build(self, **kw):
         goodnode.__init__(self)
         self.expect_to_be = SCons.Node.failed
     def build(self, **kw):
-        raise Exception, 'badnode exception'
+        raise Exception('badnode exception')
 
 class slowbadnode (badnode):
     def build(self, **kw):
 
 class slowbadnode (badnode):
     def build(self, **kw):
@@ -407,11 +407,11 @@ class slowbadnode (badnode):
         # it is faster than slowgoodnode then these could complete
         # while the scheduler is sleeping.
         time.sleep(0.05)
         # it is faster than slowgoodnode then these could complete
         # while the scheduler is sleeping.
         time.sleep(0.05)
-        raise Exception, 'slowbadnode exception'
+        raise Exception('slowbadnode exception')
 
 class badpreparenode (badnode):
     def prepare(self):
 
 class badpreparenode (badnode):
     def prepare(self):
-        raise Exception, 'badpreparenode exception'
+        raise Exception('badpreparenode exception')
 
 class _SConsTaskTest(unittest.TestCase):
 
 
 class _SConsTaskTest(unittest.TestCase):
 
index 4566d31bdda51bda698d553fcdd1b04fbe9913cb..30e7d9fa16df31803d6246c466c4fae57eff98df 100644 (file)
@@ -257,7 +257,7 @@ if not use_metaclass:
     def EnableMemoization():
         import SCons.Warnings
         msg = 'memoization is not supported in this version of Python (%s)'
     def EnableMemoization():
         import SCons.Warnings
         msg = 'memoization is not supported in this version of Python (%s)'
-        raise SCons.Warnings.NoMetaclassSupportWarning, msg % reason
+        raise SCons.Warnings.NoMetaclassSupportWarning(msg % reason)
 
 else:
 
 
 else:
 
index acba76ea267dcee9f8fb9193a4f5e9b3d72e7641..6dd5b0b78db163b4b6025e9e21ea442ca429ba27 100644 (file)
@@ -255,7 +255,7 @@ def set_duplicate(duplicate):
     }
 
     if not duplicate in Valid_Duplicates:
     }
 
     if not duplicate in Valid_Duplicates:
-        raise SCons.Errors.InternalError("The argument of set_duplicate "
+        raise SCons.Errors.InternalError("The argument of set_duplicate "
                                            "should be in Valid_Duplicates")
     global Link_Funcs
     Link_Funcs = []
                                            "should be in Valid_Duplicates")
     global Link_Funcs
     Link_Funcs = []
@@ -406,7 +406,7 @@ def do_diskcheck_match(node, predicate, errorfmt):
     except (AttributeError, KeyError):
         pass
     if result:
     except (AttributeError, KeyError):
         pass
     if result:
-        raise TypeError, errorfmt % node.abspath
+        raise TypeError(errorfmt % node.abspath)
 
 def ignore_diskcheck_match(node, predicate, errorfmt):
     pass
 
 def ignore_diskcheck_match(node, predicate, errorfmt):
     pass
@@ -619,8 +619,8 @@ class Base(SCons.Node.Node):
         """
         if isinstance(self, klass) or klass is Entry:
             return
         """
         if isinstance(self, klass) or klass is Entry:
             return
-        raise TypeError"Tried to lookup %s '%s' as a %s." %\
-              (self.__class__.__name__, self.path, klass.__name__)
+        raise TypeError("Tried to lookup %s '%s' as a %s." %\
+              (self.__class__.__name__, self.path, klass.__name__))
 
     def get_dir(self):
         return self.dir
 
     def get_dir(self):
         return self.dir
@@ -910,7 +910,7 @@ class Entry(Base):
                 self._morph()
             elif must_exist:
                 msg = "No such file or directory: '%s'" % self.abspath
                 self._morph()
             elif must_exist:
                 msg = "No such file or directory: '%s'" % self.abspath
-                raise SCons.Errors.UserError, msg
+                raise SCons.Errors.UserError(msg)
             else:
                 self.__class__ = File
                 self._morph()
             else:
                 self.__class__ = File
                 self._morph()
@@ -989,7 +989,7 @@ class Entry(Base):
     def rel_path(self, other):
         d = self.disambiguate()
         if d.__class__ is Entry:
     def rel_path(self, other):
         d = self.disambiguate()
         if d.__class__ is Entry:
-            raise "rel_path() could not disambiguate File/Dir"
+            raise Exception("rel_path() could not disambiguate File/Dir")
         return d.rel_path(other)
 
     def new_ninfo(self):
         return d.rel_path(other)
 
     def new_ninfo(self):
@@ -1293,11 +1293,11 @@ class FS(LocalFS):
         if not isinstance(variant_dir, SCons.Node.Node):
             variant_dir = self.Dir(variant_dir)
         if src_dir.is_under(variant_dir):
         if not isinstance(variant_dir, SCons.Node.Node):
             variant_dir = self.Dir(variant_dir)
         if src_dir.is_under(variant_dir):
-            raise SCons.Errors.UserError, "Source directory cannot be under variant directory."
+            raise SCons.Errors.UserError("Source directory cannot be under variant directory.")
         if variant_dir.srcdir:
             if variant_dir.srcdir == src_dir:
                 return # We already did this.
         if variant_dir.srcdir:
             if variant_dir.srcdir == src_dir:
                 return # We already did this.
-            raise SCons.Errors.UserError, "'%s' already has a source directory: '%s'."%(variant_dir, variant_dir.srcdir)
+            raise SCons.Errors.UserError("'%s' already has a source directory: '%s'."%(variant_dir, variant_dir.srcdir))
         variant_dir.link(src_dir, duplicate)
 
     def Repository(self, *dirs):
         variant_dir.link(src_dir, duplicate)
 
     def Repository(self, *dirs):
@@ -1640,7 +1640,7 @@ class Dir(Base):
             if p is None:
                 # Don't use while: - else: for this condition because
                 # if so, then parent is None and has no .path attribute.
             if p is None:
                 # Don't use while: - else: for this condition because
                 # if so, then parent is None and has no .path attribute.
-                raise SCons.Errors.StopError, parent.path
+                raise SCons.Errors.StopError(parent.path)
             parent = p
         listDirs.reverse()
         for dirnode in listDirs:
             parent = p
         listDirs.reverse()
         for dirnode in listDirs:
@@ -2104,7 +2104,7 @@ class RootDir(Dir):
         except KeyError:
             if not create:
                 msg = "No such file or directory: '%s' in '%s' (and create is False)" % (p, str(self))
         except KeyError:
             if not create:
                 msg = "No such file or directory: '%s' in '%s' (and create is False)" % (p, str(self))
-                raise SCons.Errors.UserError, msg
+                raise SCons.Errors.UserError(msg)
             # There is no Node for this path name, and we're allowed
             # to create it.
             dir_name, file_name = os.path.split(p)
             # There is no Node for this path name, and we're allowed
             # to create it.
             dir_name, file_name = os.path.split(p)
@@ -2734,7 +2734,7 @@ class File(Base):
                     self._createDir()
                 except SCons.Errors.StopError, drive:
                     desc = "No drive `%s' for target `%s'." % (drive, self)
                     self._createDir()
                 except SCons.Errors.StopError, drive:
                     desc = "No drive `%s' for target `%s'." % (drive, self)
-                    raise SCons.Errors.StopError, desc
+                    raise SCons.Errors.StopError(desc)
 
     #
     #
 
     #
     #
@@ -2753,7 +2753,7 @@ class File(Base):
         e = Link(self, src, None)
         if isinstance(e, SCons.Errors.BuildError):
             desc = "Cannot duplicate `%s' in `%s': %s." % (src.path, self.dir.path, e.errstr)
         e = Link(self, src, None)
         if isinstance(e, SCons.Errors.BuildError):
             desc = "Cannot duplicate `%s' in `%s': %s." % (src.path, self.dir.path, e.errstr)
-            raise SCons.Errors.StopError, desc
+            raise SCons.Errors.StopError(desc)
         self.linked = 1
         # The Link() action may or may not have actually
         # created the file, depending on whether the -n
         self.linked = 1
         # The Link() action may or may not have actually
         # created the file, depending on whether the -n
index 01ceb5118a2cfeb41e45f8845eb2b60b61ded872..8ced54887e0540e6f840c6446767701faba764aa 100644 (file)
@@ -358,7 +358,7 @@ class VariantDirTestCase(unittest.TestCase):
 
         save_Link = SCons.Node.FS.Link
         def Link_IOError(target, source, env):
 
         save_Link = SCons.Node.FS.Link
         def Link_IOError(target, source, env):
-            raise IOError(17, "Link_IOError")
+            raise IOError(17, "Link_IOError")
         SCons.Node.FS.Link = SCons.Action.Action(Link_IOError, None)
 
         test.write(['work', 'src', 'IOError'], "work/src/IOError\n")
         SCons.Node.FS.Link = SCons.Action.Action(Link_IOError, None)
 
         test.write(['work', 'src', 'IOError'], "work/src/IOError\n")
@@ -892,7 +892,7 @@ class FSTestCase(_tempdirTestCase):
         except TypeError:
             pass
         else:
         except TypeError:
             pass
         else:
-            raise Exception, "did not catch expected TypeError"
+            raise Exception("did not catch expected TypeError")
 
         assert x1.Entry(x4) == x4
         try:
 
         assert x1.Entry(x4) == x4
         try:
@@ -900,7 +900,7 @@ class FSTestCase(_tempdirTestCase):
         except TypeError:
             pass
         else:
         except TypeError:
             pass
         else:
-            raise Exception, "did not catch expected TypeError"
+            raise Exception("did not catch expected TypeError")
 
         x6 = x1.File(x6)
         assert isinstance(x6, SCons.Node.FS.File)
 
         x6 = x1.File(x6)
         assert isinstance(x6, SCons.Node.FS.File)
@@ -1207,7 +1207,7 @@ class FSTestCase(_tempdirTestCase):
             except SCons.Errors.UserError:
                 pass
             else:
             except SCons.Errors.UserError:
                 pass
             else:
-                raise Exception, "did not catch expected UserError"
+                raise Exception("did not catch expected UserError")
 
         nonexistent(fs.Entry, 'nonexistent')
         nonexistent(fs.Entry, 'nonexistent/foo')
 
         nonexistent(fs.Entry, 'nonexistent')
         nonexistent(fs.Entry, 'nonexistent/foo')
index 5f1b4b0908b3ab81f166d013342bbce8cfad2239..6de6d386da5dd9da6b266837ef88ca1ada93da54 100644 (file)
@@ -54,7 +54,7 @@ def _actionAppend(a1, a2):
         elif isinstance(curr_a, list):
             all.extend(curr_a)
         else:
         elif isinstance(curr_a, list):
             all.extend(curr_a)
         else:
-            raise 'Cannot Combine Actions'
+            raise Exception('Cannot Combine Actions')
     return MyListAction(all)
 
 class MyActionBase:
     return MyListAction(all)
 
 class MyActionBase:
@@ -178,7 +178,7 @@ class ExceptBuilder:
 
 class ExceptBuilder2:
     def execute(self, target, source, env):
 
 class ExceptBuilder2:
     def execute(self, target, source, env):
-        raise "foo"
+        raise Exception("foo")
 
 class Scanner:
     called = None
 
 class Scanner:
     called = None
@@ -787,7 +787,7 @@ class NodeTestCase(unittest.TestCase):
         except:
             pass
         else:
         except:
             pass
         else:
-            raise "did not catch expected exception"
+            raise Exception("did not catch expected exception")
         assert node.depends == [zero, one, two, three, four]
 
 
         assert node.depends == [zero, one, two, three, four]
 
 
@@ -819,7 +819,7 @@ class NodeTestCase(unittest.TestCase):
         except:
             pass
         else:
         except:
             pass
         else:
-            raise "did not catch expected exception"
+            raise Exception("did not catch expected exception")
         assert node.sources == [zero, one, two, three, four], node.sources
 
     def test_add_ignore(self):
         assert node.sources == [zero, one, two, three, four], node.sources
 
     def test_add_ignore(self):
@@ -850,7 +850,7 @@ class NodeTestCase(unittest.TestCase):
         except:
             pass
         else:
         except:
             pass
         else:
-            raise "did not catch expected exception"
+            raise Exception("did not catch expected exception")
         assert node.ignore == [zero, one, two, three, four]
 
     def test_get_found_includes(self):
         assert node.ignore == [zero, one, two, three, four]
 
     def test_get_found_includes(self):
index 472f99f04866f62e83351a3633320792c888dd29..d635933e7c6c38afe08121808828e3bd3c5207b3 100644 (file)
@@ -350,12 +350,12 @@ class Node:
         for d in self.depends:
             if d.missing():
                 msg = "Explicit dependency `%s' not found, needed by target `%s'."
         for d in self.depends:
             if d.missing():
                 msg = "Explicit dependency `%s' not found, needed by target `%s'."
-                raise SCons.Errors.StopError, msg % (d, self)
+                raise SCons.Errors.StopError(msg % (d, self))
         if self.implicit is not None:
             for i in self.implicit:
                 if i.missing():
                     msg = "Implicit dependency `%s' not found, needed by target `%s'."
         if self.implicit is not None:
             for i in self.implicit:
                 if i.missing():
                     msg = "Implicit dependency `%s' not found, needed by target `%s'."
-                    raise SCons.Errors.StopError, msg % (i, self)
+                    raise SCons.Errors.StopError(msg % (i, self))
         self.binfo = self.get_binfo()
 
     def build(self, **kw):
         self.binfo = self.get_binfo()
 
     def build(self, **kw):
index 2ae1e9726f473691eb8f169115bd3df5625551f7..244d0900283800b7c46e38bac399bc9be1e3134d 100644 (file)
@@ -111,7 +111,7 @@ def platform_module(name = platform_default()):
                     importer = zipimport.zipimporter( sys.modules['SCons.Platform'].__path__[0] )
                     mod = importer.load_module(full_name)
                 except ImportError:
                     importer = zipimport.zipimporter( sys.modules['SCons.Platform'].__path__[0] )
                     mod = importer.load_module(full_name)
                 except ImportError:
-                    raise SCons.Errors.UserError, "No platform named '%s'" % name
+                    raise SCons.Errors.UserError("No platform named '%s'" % name)
             setattr(SCons.Platform, name, mod)
     return sys.modules[full_name]
 
             setattr(SCons.Platform, name, mod)
     return sys.modules[full_name]
 
index ac019ad3445fdadb539d417c28e55b21a98d99ac..387312b277bbe236b046a0918f8faf81563a4d9c 100644 (file)
@@ -79,7 +79,7 @@ def SetCacheMode(mode):
     elif mode == "cache":
         cache_mode = CACHE
     else:
     elif mode == "cache":
         cache_mode = CACHE
     else:
-        raise ValueError, "SCons.SConf.SetCacheMode: Unknown mode " + mode
+        raise ValueError("SCons.SConf.SetCacheMode: Unknown mode " + mode)
 
 progress_display = SCons.Util.display # will be overwritten by SCons.Script
 def SetProgressDisplay(display):
 
 progress_display = SCons.Util.display # will be overwritten by SCons.Script
 def SetProgressDisplay(display):
@@ -397,8 +397,7 @@ class SConfBase:
             SConfFS = SCons.Node.FS.default_fs or \
                       SCons.Node.FS.FS(env.fs.pathTop)
         if sconf_global is not None:
             SConfFS = SCons.Node.FS.default_fs or \
                       SCons.Node.FS.FS(env.fs.pathTop)
         if sconf_global is not None:
-            raise (SCons.Errors.UserError,
-                   "Only one SConf object may be active at one time")
+            raise SCons.Errors.UserError
         self.env = env
         if log_file is not None:
             log_file = SConfFS.File(env.subst(log_file))
         self.env = env
         if log_file is not None:
             log_file = SConfFS.File(env.subst(log_file))
@@ -639,8 +638,7 @@ class SConfBase:
             self.sconf = sconf
         def __call__(self, *args, **kw):
             if not self.sconf.active:
             self.sconf = sconf
         def __call__(self, *args, **kw):
             if not self.sconf.active:
-                raise (SCons.Errors.UserError,
-                       "Test called after sconf.Finish()")
+                raise SCons.Errors.UserError
             context = CheckContext(self.sconf)
             ret = self.test(context, *args, **kw)
             if self.sconf.config_h is not None:
             context = CheckContext(self.sconf)
             ret = self.test(context, *args, **kw)
             if self.sconf.config_h is not None:
@@ -721,7 +719,7 @@ class SConfBase:
         global sconf_global, _ac_config_hs
 
         if not self.active:
         global sconf_global, _ac_config_hs
 
         if not self.active:
-            raise SCons.Errors.UserError, "Finish may be called only once!"
+            raise SCons.Errors.UserError("Finish may be called only once!")
         if self.logstream is not None and not dryrun:
             self.logstream.write("\n")
             self.logstream.close()
         if self.logstream is not None and not dryrun:
             self.logstream.write("\n")
             self.logstream.close()
@@ -793,7 +791,7 @@ class CheckContext:
         elif isinstance(res, str):
             text = res
         else:
         elif isinstance(res, str):
             text = res
         else:
-            raise TypeError, "Expected string, int or bool, got " + str(type(res))
+            raise TypeError("Expected string, int or bool, got " + str(type(res)))
 
         if self.did_show_result == 0:
             # Didn't show result yet, do it now.
 
         if self.did_show_result == 0:
             # Didn't show result yet, do it now.
@@ -821,7 +819,7 @@ class CheckContext:
         elif( attr == 'lastTarget' ):
             return self.sconf.lastTarget
         else:
         elif( attr == 'lastTarget' ):
             return self.sconf.lastTarget
         else:
-            raise AttributeError, "CheckContext instance has no attribute '%s'" % attr
+            raise AttributeError("CheckContext instance has no attribute '%s'" % attr)
 
     #### Stuff used by Conftest.py (look there for explanations).
 
 
     #### Stuff used by Conftest.py (look there for explanations).
 
index 4d29b789eb7b7371ae386a64f46ab941f6ce6eaf..2b2380da60918db5a3fe604cb04c311a9a47e08c 100644 (file)
@@ -85,7 +85,7 @@ class SConfTestCase(unittest.TestCase):
         if (not self.scons_env.Detect( self.scons_env.subst('$CXX') ) or
             not self.scons_env.Detect( self.scons_env.subst('$CC') ) or
             not self.scons_env.Detect( self.scons_env.subst('$LINK') )):
         if (not self.scons_env.Detect( self.scons_env.subst('$CXX') ) or
             not self.scons_env.Detect( self.scons_env.subst('$CC') ) or
             not self.scons_env.Detect( self.scons_env.subst('$LINK') )):
-            raise Exception, "This test needs an installed compiler!"
+            raise Exception("This test needs an installed compiler!")
         if self.scons_env['CXX'] == 'g++':
             global existing_lib
             existing_lib = 'm'
         if self.scons_env['CXX'] == 'g++':
             global existing_lib
             existing_lib = 'm'
index 7ae584aed2b9dd452a8a539e5c7f9ff69b49172f..c7f560e904e93513ad952c3e2d4928cbd4d64b6a 100644 (file)
@@ -143,14 +143,14 @@ class BaseTestCase(SConsignTestCase):
         except KeyError:
             pass
         else:
         except KeyError:
             pass
         else:
-            raise "unexpected entry %s" % e
+            raise Exception("unexpected entry %s" % e)
 
         try:
             e = f.get_entry('bbb')
         except KeyError:
             pass
         else:
 
         try:
             e = f.get_entry('bbb')
         except KeyError:
             pass
         else:
-            raise "unexpected entry %s" % e
+            raise Exception("unexpected entry %s" % e)
 
         f.merge()
 
 
         f.merge()
 
index b75da5809211b9508d6e25cabd2a1b7d17a18285..9ebe2e673450146885fa8bb844074f4733dc49be 100644 (file)
@@ -218,7 +218,7 @@ class DummyEnvironment:
         elif len(args) == 1 and args[0] == 'FORTRANPATH':
             return self.path
         else:
         elif len(args) == 1 and args[0] == 'FORTRANPATH':
             return self.path
         else:
-            raise KeyError, "Dummy environment only has FORTRANPATH attribute."
+            raise KeyError("Dummy environment only has FORTRANPATH attribute.")
 
     def has_key(self, key):
         return key in self.Dictionary()
 
     def has_key(self, key):
         return key in self.Dictionary()
index 096fc9fac9f39c7f6f060b68dd50690844efc205..54b23730fa83cfcbbfd78f652bacb049cb58708b 100644 (file)
@@ -197,7 +197,7 @@ class DummyEnvironment:
         elif len(args) == 1 and args[0] == 'CPPPATH':
             return self.path
         else:
         elif len(args) == 1 and args[0] == 'CPPPATH':
             return self.path
         else:
-            raise KeyError, "Dummy environment only has CPPPATH attribute."
+            raise KeyError("Dummy environment only has CPPPATH attribute.")
 
     def subst(self, arg, target=None, source=None, conv=None):
         return arg
 
     def subst(self, arg, target=None, source=None, conv=None):
         return arg
index 7909b0bbcfdf6f0e1391e665da2aa91939d4a476..96fc4b74cafda752b7d74c08ba1794a674decf38 100644 (file)
@@ -683,7 +683,7 @@ def _load_site_scons_dir(topdir, site_dir_name=None):
     site_dir = os.path.join(topdir.path, site_dir_name)
     if not os.path.exists(site_dir):
         if err_if_not_found:
     site_dir = os.path.join(topdir.path, site_dir_name)
     if not os.path.exists(site_dir):
         if err_if_not_found:
-            raise SCons.Errors.UserError, "site dir %s not found."%site_dir
+            raise SCons.Errors.UserError("site dir %s not found."%site_dir)
         return
 
     site_init_filename = "site_init.py"
         return
 
     site_init_filename = "site_init.py"
@@ -710,7 +710,7 @@ def _load_site_scons_dir(topdir, site_dir_name=None):
                     m = sys.modules['SCons.Script']
                 except Exception, e:
                     fmt = 'cannot import site_init.py: missing SCons.Script module %s'
                     m = sys.modules['SCons.Script']
                 except Exception, e:
                     fmt = 'cannot import site_init.py: missing SCons.Script module %s'
-                    raise SCons.Errors.InternalError, fmt % repr(e)
+                    raise SCons.Errors.InternalError(fmt % repr(e))
                 try:
                     # This is the magic.
                     exec fp in m.__dict__
                 try:
                     # This is the magic.
                     exec fp in m.__dict__
@@ -851,7 +851,7 @@ def _main(parser):
             # Give them the options usage now, before we fail
             # trying to read a non-existent SConstruct file.
             raise SConsPrintHelpException
             # Give them the options usage now, before we fail
             # trying to read a non-existent SConstruct file.
             raise SConsPrintHelpException
-        raise SCons.Errors.UserError, "No SConstruct file found."
+        raise SCons.Errors.UserError("No SConstruct file found.")
 
     if scripts[0] == "-":
         d = fs.getcwd()
 
     if scripts[0] == "-":
         d = fs.getcwd()
index 0f364d6a980450183f5a8015699cf2f63eb2ff37..246d4eb3a414bc3f302e2c5ea67cdf5fa6e07be4 100644 (file)
@@ -65,7 +65,7 @@ def diskcheck_convert(value):
         elif v in diskcheck_all:
             result.append(v)
         else:
         elif v in diskcheck_all:
             result.append(v)
         else:
-            raise ValueError, v
+            raise ValueError(v)
     return result
 
 class SConsValues(optparse.Values):
     return result
 
 class SConsValues(optparse.Values):
@@ -139,7 +139,7 @@ class SConsValues(optparse.Values):
         Sets an option from an SConscript file.
         """
         if not name in self.settable:
         Sets an option from an SConscript file.
         """
         if not name in self.settable:
-            raise SCons.Errors.UserError, "This option is not settable from a SConscript file: %s"%name
+            raise SCons.Errors.UserError("This option is not settable from a SConscript file: %s"%name)
 
         if name == 'num_jobs':
             try:
 
         if name == 'num_jobs':
             try:
@@ -147,19 +147,19 @@ class SConsValues(optparse.Values):
                 if value < 1:
                     raise ValueError
             except ValueError:
                 if value < 1:
                     raise ValueError
             except ValueError:
-                raise SCons.Errors.UserError, "A positive integer is required: %s"%repr(value)
+                raise SCons.Errors.UserError("A positive integer is required: %s"%repr(value))
         elif name == 'max_drift':
             try:
                 value = int(value)
             except ValueError:
         elif name == 'max_drift':
             try:
                 value = int(value)
             except ValueError:
-                raise SCons.Errors.UserError, "An integer is required: %s"%repr(value)
+                raise SCons.Errors.UserError("An integer is required: %s"%repr(value))
         elif name == 'duplicate':
             try:
                 value = str(value)
             except ValueError:
         elif name == 'duplicate':
             try:
                 value = str(value)
             except ValueError:
-                raise SCons.Errors.UserError, "A string is required: %s"%repr(value)
+                raise SCons.Errors.UserError("A string is required: %s"%repr(value))
             if not value in SCons.Node.FS.Valid_Duplicates:
             if not value in SCons.Node.FS.Valid_Duplicates:
-                raise SCons.Errors.UserError, "Not a valid duplication style: %s" % value
+                raise SCons.Errors.UserError("Not a valid duplication style: %s" % value)
             # Set the duplicate style right away so it can affect linking
             # of SConscript files.
             SCons.Node.FS.set_duplicate(value)
             # Set the duplicate style right away so it can affect linking
             # of SConscript files.
             SCons.Node.FS.set_duplicate(value)
@@ -167,7 +167,7 @@ class SConsValues(optparse.Values):
             try:
                 value = diskcheck_convert(value)
             except ValueError, v:
             try:
                 value = diskcheck_convert(value)
             except ValueError, v:
-                raise SCons.Errors.UserError, "Not a valid diskcheck value: %s"%v
+                raise SCons.Errors.UserError("Not a valid diskcheck value: %s"%v)
             if 'diskcheck' not in self.__dict__:
                 # No --diskcheck= option was specified on the command line.
                 # Set this right away so it can affect the rest of the
             if 'diskcheck' not in self.__dict__:
                 # No --diskcheck= option was specified on the command line.
                 # Set this right away so it can affect the rest of the
@@ -177,12 +177,12 @@ class SConsValues(optparse.Values):
             try:
                 value = int(value)
             except ValueError:
             try:
                 value = int(value)
             except ValueError:
-                raise SCons.Errors.UserError, "An integer is required: %s"%repr(value)
+                raise SCons.Errors.UserError("An integer is required: %s"%repr(value))
         elif name == 'md5_chunksize':
             try:
                 value = int(value)
             except ValueError:
         elif name == 'md5_chunksize':
             try:
                 value = int(value)
             except ValueError:
-                raise SCons.Errors.UserError, "An integer is required: %s"%repr(value)
+                raise SCons.Errors.UserError("An integer is required: %s"%repr(value))
         elif name == 'warn':
             if SCons.Util.is_String(value):
                 value = [value]
         elif name == 'warn':
             if SCons.Util.is_String(value):
                 value = [value]
@@ -214,7 +214,7 @@ class SConsOption(optparse.Option):
     def _check_nargs_optional(self):
         if self.nargs == '?' and self._short_opts:
             fmt = "option %s: nargs='?' is incompatible with short options"
     def _check_nargs_optional(self):
         if self.nargs == '?' and self._short_opts:
             fmt = "option %s: nargs='?' is incompatible with short options"
-            raise SCons.Errors.UserError, fmt % self._short_opts[0]
+            raise SCons.Errors.UserError(fmt % self._short_opts[0])
 
     try:
         _orig_CONST_ACTIONS = optparse.Option.CONST_ACTIONS
 
     try:
         _orig_CONST_ACTIONS = optparse.Option.CONST_ACTIONS
index 4e4338298e46b5def0ff134f0fe0f944cceb354e..7640ec85535170c98efe0a6785b225c101b379a4 100644 (file)
@@ -115,7 +115,7 @@ def compute_exports(exports):
                 except KeyError:
                     retval[export] = glob[export]
     except KeyError, x:
                 except KeyError:
                     retval[export] = glob[export]
     except KeyError, x:
-        raise SCons.Errors.UserError, "Export of non-existent variable '%s'"%x
+        raise SCons.Errors.UserError("Export of non-existent variable '%s'"%x)
 
     return retval
 
 
     return retval
 
@@ -147,7 +147,7 @@ def Return(*vars, **kw):
             for v in var.split():
                 retval.append(call_stack[-1].globals[v])
     except KeyError, x:
             for v in var.split():
                 retval.append(call_stack[-1].globals[v])
     except KeyError, x:
-        raise SCons.Errors.UserError, "Return of non-existent variable '%s'"%x
+        raise SCons.Errors.UserError("Return of non-existent variable '%s'"%x)
 
     if len(retval) == 1:
         call_stack[-1].retval = retval[0]
 
     if len(retval) == 1:
         call_stack[-1].retval = retval[0]
@@ -337,7 +337,7 @@ def annotate(node):
         tb = tb.tb_next
     if not tb:
         # We did not find any exec of an SConscript file: what?!
         tb = tb.tb_next
     if not tb:
         # We did not find any exec of an SConscript file: what?!
-        raise SCons.Errors.InternalError, "could not find SConscript stack frame"
+        raise SCons.Errors.InternalError("could not find SConscript stack frame")
     node.creator = traceback.extract_stack(tb)[0]
 
 # The following line would cause each Node to be annotated using the
     node.creator = traceback.extract_stack(tb)[0]
 
 # The following line would cause each Node to be annotated using the
@@ -390,8 +390,7 @@ class SConsEnvironment(SCons.Environment.Base):
             try:
                 dirs = kw["dirs"]
             except KeyError:
             try:
                 dirs = kw["dirs"]
             except KeyError:
-                raise SCons.Errors.UserError, \
-                      "Invalid SConscript usage - no parameters"
+                raise SCons.Errors.UserError("Invalid SConscript usage - no parameters")
 
             if not SCons.Util.is_List(dirs):
                 dirs = [ dirs ]
 
             if not SCons.Util.is_List(dirs):
                 dirs = [ dirs ]
@@ -412,8 +411,7 @@ class SConsEnvironment(SCons.Environment.Base):
 
         else:
 
 
         else:
 
-            raise SCons.Errors.UserError, \
-                  "Invalid SConscript() usage - too many arguments"
+            raise SCons.Errors.UserError("Invalid SConscript() usage - too many arguments")
 
         if not SCons.Util.is_List(files):
             files = [ files ]
 
         if not SCons.Util.is_List(files):
             files = [ files ]
@@ -424,8 +422,7 @@ class SConsEnvironment(SCons.Environment.Base):
         variant_dir = kw.get('variant_dir') or kw.get('build_dir')
         if variant_dir:
             if len(files) != 1:
         variant_dir = kw.get('variant_dir') or kw.get('build_dir')
         if variant_dir:
             if len(files) != 1:
-                raise SCons.Errors.UserError, \
-                    "Invalid SConscript() usage - can only specify one SConscript with a variant_dir"
+                raise SCons.Errors.UserError("Invalid SConscript() usage - can only specify one SConscript with a variant_dir")
             duplicate = kw.get('duplicate', 1)
             src_dir = kw.get('src_dir')
             if not src_dir:
             duplicate = kw.get('duplicate', 1)
             src_dir = kw.get('src_dir')
             if not src_dir:
@@ -456,7 +453,7 @@ class SConsEnvironment(SCons.Environment.Base):
 
     def Configure(self, *args, **kw):
         if not SCons.Script.sconscript_reading:
 
     def Configure(self, *args, **kw):
         if not SCons.Script.sconscript_reading:
-            raise SCons.Errors.UserError, "Calling Configure from Builders is not supported."
+            raise SCons.Errors.UserError("Calling Configure from Builders is not supported.")
         kw['_depth'] = kw.get('_depth', 0) + 1
         return SCons.Environment.Base.Configure(self, *args, **kw)
 
         kw['_depth'] = kw.get('_depth', 0) + 1
         return SCons.Environment.Base.Configure(self, *args, **kw)
 
@@ -524,7 +521,7 @@ class SConsEnvironment(SCons.Environment.Base):
                         else:
                             globals[v] = global_exports[v]
         except KeyError,x:
                         else:
                             globals[v] = global_exports[v]
         except KeyError,x:
-            raise SCons.Errors.UserError, "Import of non-existent variable '%s'"%x
+            raise SCons.Errors.UserError("Import of non-existent variable '%s'"%x)
 
     def SConscript(self, *ls, **kw):
         def subst_element(x, subst=self.subst):
 
     def SConscript(self, *ls, **kw):
         def subst_element(x, subst=self.subst):
@@ -566,7 +563,7 @@ SCons.Environment.Environment = SConsEnvironment
 
 def Configure(*args, **kw):
     if not SCons.Script.sconscript_reading:
 
 def Configure(*args, **kw):
     if not SCons.Script.sconscript_reading:
-        raise SCons.Errors.UserError, "Calling Configure from Builders is not supported."
+        raise SCons.Errors.UserError("Calling Configure from Builders is not supported.")
     kw['_depth'] = 1
     return SCons.SConf.SConf(*args, **kw)
 
     kw['_depth'] = 1
     return SCons.SConf.SConf(*args, **kw)
 
index a0a48597601961d4630effdab0530b5d119bc198..caddd7579a496920a356e5c7709dc73ecfeab07a 100644 (file)
@@ -54,9 +54,9 @@ def raise_exception(exception, target, s):
     name = exception.__class__.__name__
     msg = "%s `%s' trying to evaluate `%s'" % (name, exception, s)
     if target:
     name = exception.__class__.__name__
     msg = "%s `%s' trying to evaluate `%s'" % (name, exception, s)
     if target:
-        raise SCons.Errors.BuildError(target[0], msg)
+        raise SCons.Errors.BuildError(target[0], msg)
     else:
     else:
-        raise SCons.Errors.UserError, msg
+        raise SCons.Errors.UserError(msg)
 
 
 
 
 
 
@@ -238,7 +238,7 @@ class Target_or_Source:
         except IndexError:
             # If there is nothing in the list, then we have no attributes to
             # pass through, so raise AttributeError for everything.
         except IndexError:
             # If there is nothing in the list, then we have no attributes to
             # pass through, so raise AttributeError for everything.
-            raise AttributeError, "NodeList has no attribute: %s" % attr
+            raise AttributeError("NodeList has no attribute: %s" % attr)
         return getattr(nl0, attr)
     def __str__(self):
         nl = self.nl._create_nodelist()
         return getattr(nl0, attr)
     def __str__(self):
         nl = self.nl._create_nodelist()
index b423fa4e855106748181a1f811e217c375c05f5e..0334f14a98505a8c63ef42e578ef844f4b62df8c 100644 (file)
@@ -524,7 +524,7 @@ class scons_subst_TestCase(SubstTestCase):
             ]
             assert str(e) in expect, e
         else:
             ]
             assert str(e) in expect, e
         else:
-            raise AssertionError, "did not catch expected UserError"
+            raise AssertionError("did not catch expected UserError")
 
     def test_subst_syntax_errors(self):
         """Test scons_subst():  handling syntax errors"""
 
     def test_subst_syntax_errors(self):
         """Test scons_subst():  handling syntax errors"""
@@ -542,7 +542,7 @@ class scons_subst_TestCase(SubstTestCase):
             ]
             assert str(e) in expect, e
         else:
             ]
             assert str(e) in expect, e
         else:
-            raise AssertionError, "did not catch expected UserError"
+            raise AssertionError("did not catch expected UserError")
 
     def test_subst_type_errors(self):
         """Test scons_subst():  handling type errors"""
 
     def test_subst_type_errors(self):
         """Test scons_subst():  handling type errors"""
@@ -558,7 +558,7 @@ class scons_subst_TestCase(SubstTestCase):
             ]
             assert str(e) in expect, e
         else:
             ]
             assert str(e) in expect, e
         else:
-            raise AssertionError, "did not catch expected UserError"
+            raise AssertionError("did not catch expected UserError")
 
         try:
             def func(a, b, c):
 
         try:
             def func(a, b, c):
@@ -573,7 +573,7 @@ class scons_subst_TestCase(SubstTestCase):
             ]
             assert str(e) in expect, repr(str(e))
         else:
             ]
             assert str(e) in expect, repr(str(e))
         else:
-            raise AssertionError, "did not catch expected UserError"
+            raise AssertionError("did not catch expected UserError")
 
     def test_subst_raw_function(self):
         """Test scons_subst():  fetch function with SUBST_RAW plus conv"""
 
     def test_subst_raw_function(self):
         """Test scons_subst():  fetch function with SUBST_RAW plus conv"""
@@ -978,7 +978,7 @@ class scons_subst_list_TestCase(SubstTestCase):
             ]
             assert str(e) in expect, e
         else:
             ]
             assert str(e) in expect, e
         else:
-            raise AssertionError, "did not catch expected UserError"
+            raise AssertionError("did not catch expected UserError")
 
     def test_subst_syntax_errors(self):
         """Test scons_subst_list():  handling syntax errors"""
 
     def test_subst_syntax_errors(self):
         """Test scons_subst_list():  handling syntax errors"""
@@ -993,7 +993,7 @@ class scons_subst_list_TestCase(SubstTestCase):
             ]
             assert str(e) in expect, e
         else:
             ]
             assert str(e) in expect, e
         else:
-            raise AssertionError, "did not catch expected SyntaxError"
+            raise AssertionError("did not catch expected SyntaxError")
 
     def test_subst_raw_function(self):
         """Test scons_subst_list():  fetch function with SUBST_RAW plus conv"""
 
     def test_subst_raw_function(self):
         """Test scons_subst_list():  fetch function with SUBST_RAW plus conv"""
index 1b42bcb2dd71cb8ba2274c09478152b02c8af294..f60b2e254b3e77e0822a1ebcdf02bffbd01b32a9 100644 (file)
@@ -1023,7 +1023,7 @@ class Taskmaster:
                     "  Internal Error: no cycle found for node %s (%s) in state %s\n" %  \
                     (node, repr(node), StateString[node.get_state()])
 
                     "  Internal Error: no cycle found for node %s (%s) in state %s\n" %  \
                     (node, repr(node), StateString[node.get_state()])
 
-        raise SCons.Errors.UserError, desc
+        raise SCons.Errors.UserError(desc)
 
 # Local Variables:
 # tab-width:4
 
 # Local Variables:
 # tab-width:4
index 917bb622479636224ade248472d425d4783f80c8..3dd22e3e9137f6bda3f93cfbe3f35e817fb8bbac 100644 (file)
@@ -539,7 +539,7 @@ class TaskmasterTestCase(unittest.TestCase):
         """
         class MyTask(SCons.Taskmaster.Task):
             def make_ready(self):
         """
         class MyTask(SCons.Taskmaster.Task):
             def make_ready(self):
-                raise MyException, "from make_ready()"
+                raise MyException("from make_ready()")
 
         n1 = Node("n1")
         tm = SCons.Taskmaster.Taskmaster(targets = [n1], tasker = MyTask)
 
         n1 = Node("n1")
         tm = SCons.Taskmaster.Taskmaster(targets = [n1], tasker = MyTask)
@@ -615,7 +615,7 @@ class TaskmasterTestCase(unittest.TestCase):
         """
         class StopNode(Node):
             def children(self):
         """
         class StopNode(Node):
             def children(self):
-                raise SCons.Errors.StopError, "stop!"
+                raise SCons.Errors.StopError("stop!")
         class ExitNode(Node):
             def children(self):
                 sys.exit(77)
         class ExitNode(Node):
             def children(self):
                 sys.exit(77)
@@ -833,7 +833,7 @@ class TaskmasterTestCase(unittest.TestCase):
         # Make sure we call an Executor's prepare() method.
         class ExceptionExecutor:
             def prepare(self):
         # Make sure we call an Executor's prepare() method.
         class ExceptionExecutor:
             def prepare(self):
-                raise Exception, "Executor.prepare() exception"
+                raise Exception("Executor.prepare() exception")
             def get_all_targets(self):
                 return self.nodes
             def get_all_children(self):
             def get_all_targets(self):
                 return self.nodes
             def get_all_children(self):
@@ -856,7 +856,7 @@ class TaskmasterTestCase(unittest.TestCase):
         except Exception, e:
             assert str(e) == "Executor.prepare() exception", e
         else:
         except Exception, e:
             assert str(e) == "Executor.prepare() exception", e
         else:
-            raise AssertionError, "did not catch expected exception"
+            raise AssertionError("did not catch expected exception")
 
     def test_execute(self):
         """Test executing a task
 
     def test_execute(self):
         """Test executing a task
@@ -881,7 +881,7 @@ class TaskmasterTestCase(unittest.TestCase):
         except SCons.Errors.UserError:
             pass
         else:
         except SCons.Errors.UserError:
             pass
         else:
-            raise TestFailed, "did not catch expected UserError"
+            raise TestFailed("did not catch expected UserError")
 
         def raise_BuildError():
             raise SCons.Errors.BuildError
 
         def raise_BuildError():
             raise SCons.Errors.BuildError
@@ -894,7 +894,7 @@ class TaskmasterTestCase(unittest.TestCase):
         except SCons.Errors.BuildError:
             pass
         else:
         except SCons.Errors.BuildError:
             pass
         else:
-            raise TestFailed, "did not catch expected BuildError"
+            raise TestFailed("did not catch expected BuildError")
 
         # On a generic (non-BuildError) exception from a Builder,
         # the target should throw a BuildError exception with the
 
         # On a generic (non-BuildError) exception from a Builder,
         # the target should throw a BuildError exception with the
@@ -914,7 +914,7 @@ class TaskmasterTestCase(unittest.TestCase):
             exc_traceback = sys.exc_info()[2]
             assert isinstance(e.exc_info[2], type(exc_traceback)), e.exc_info[2]
         else:
             exc_traceback = sys.exc_info()[2]
             assert isinstance(e.exc_info[2], type(exc_traceback)), e.exc_info[2]
         else:
-            raise TestFailed, "did not catch expected BuildError"
+            raise TestFailed("did not catch expected BuildError")
 
         built_text = None
         cache_text = []
 
         built_text = None
         cache_text = []
index 1dfeefb91f6e5ceb385c0f466fcd8d8c35dad493..f2f7190769185a2164b5130e8fbcbe951a22d1f6 100644 (file)
@@ -67,7 +67,7 @@ if java_parsing:
             if not version in ('1.1', '1.2', '1.3','1.4', '1.5', '1.6',
                                '5', '6'):
                 msg = "Java version %s not supported" % version
             if not version in ('1.1', '1.2', '1.3','1.4', '1.5', '1.6',
                                '5', '6'):
                 msg = "Java version %s not supported" % version
-                raise NotImplementedError, msg
+                raise NotImplementedError(msg)
 
             self.version = version
             self.listClasses = []
 
             self.version = version
             self.listClasses = []
index dc07192e83125a3cc3cce2fe250b1b0a49c135e0..75de6ec354c37c78595b0324881ce6b552c348bd 100644 (file)
@@ -312,7 +312,7 @@ def get_cur_sdk_dir_from_reg():
 def get_sdk_by_version(mssdk):
     if mssdk not in SupportedSDKMap:
         msg = "SDK version %s is not supported" % repr(mssdk)
 def get_sdk_by_version(mssdk):
     if mssdk not in SupportedSDKMap:
         msg = "SDK version %s is not supported" % repr(mssdk)
-        raise SCons.Errors.UserError, msg
+        raise SCons.Errors.UserError(msg)
     get_installed_sdks()
     return InstalledSDKMap.get(mssdk)
 
     get_installed_sdks()
     return InstalledSDKMap.get(mssdk)
 
@@ -338,7 +338,7 @@ def mssdk_setup_env(env):
         sdk_version = env['MSSDK_VERSION']
         if sdk_version is None:
             msg = "SDK version %s is not installed" % repr(mssdk)
         sdk_version = env['MSSDK_VERSION']
         if sdk_version is None:
             msg = "SDK version %s is not installed" % repr(mssdk)
-            raise SCons.Errors.UserError, msg
+            raise SCons.Errors.UserError(msg)
         sdk_version = env.subst(sdk_version)
         mssdk = get_sdk_by_version(sdk_version)
         sdk_dir = mssdk.get_sdk_dir()
         sdk_version = env.subst(sdk_version)
         mssdk = get_sdk_by_version(sdk_version)
         sdk_dir = mssdk.get_sdk_dir()
index 4baa9fd8d1ba8920bb4a2db479d8c8bb5ba51f63..b8aae84282e3d1493d4b99c61c8b0ce622304cda 100644 (file)
@@ -138,9 +138,7 @@ _VCVER_TO_PRODUCT_DIR = {
 }
 
 def msvc_version_to_maj_min(msvc_version):
 }
 
 def msvc_version_to_maj_min(msvc_version):
-    msvc_version_numeric = string.join(filter(lambda x: x in string.digits + ".", msvc_version), '')
-    
-    t = msvc_version_numeric.split(".")
+    t = msvc_version.split(".")
     if not len(t) == 2:
         raise ValueError("Unrecognized version %s" % msvc_version)
     try:
     if not len(t) == 2:
         raise ValueError("Unrecognized version %s" % msvc_version)
     try:
index 264166f67b283f3a0eed0807a33f492ff7fe606b..6994bc6f9b337c830130351c6f7b6b869dd7ec54 100644 (file)
@@ -387,7 +387,7 @@ def get_vs_by_version(msvs):
     debug('vs.py:get_vs_by_version()')
     if msvs not in SupportedVSMap:
         msg = "Visual Studio version %s is not supported" % repr(msvs)
     debug('vs.py:get_vs_by_version()')
     if msvs not in SupportedVSMap:
         msg = "Visual Studio version %s is not supported" % repr(msvs)
-        raise SCons.Errors.UserError, msg
+        raise SCons.Errors.UserError(msg)
     get_installed_visual_studios()
     vs = InstalledVSMap.get(msvs)
     debug('InstalledVSMap:%s'%InstalledVSMap)
     get_installed_visual_studios()
     vs = InstalledVSMap.get(msvs)
     debug('InstalledVSMap:%s'%InstalledVSMap)
@@ -451,7 +451,7 @@ def get_default_arch(env):
         arch = 'x86'
     elif not arch in msvs.get_supported_arch():
         fmt = "Visual Studio version %s does not support architecture %s"
         arch = 'x86'
     elif not arch in msvs.get_supported_arch():
         fmt = "Visual Studio version %s does not support architecture %s"
-        raise SCons.Errors.UserError, fmt % (env['MSVS_VERSION'], arch)
+        raise SCons.Errors.UserError(fmt % (env['MSVS_VERSION'], arch))
 
     return arch
 
 
     return arch
 
index dc124b50a812ac7fb06494af47012c4d032320a2..9f925b9cef19dfc9baef5926e3d72917301cf0b0 100644 (file)
@@ -45,7 +45,7 @@ def getPharLapPath():
     be found."""
 
     if not SCons.Util.can_read_reg:
     be found."""
 
     if not SCons.Util.can_read_reg:
-        raise SCons.Errors.InternalError, "No Windows registry module was found"
+        raise SCons.Errors.InternalError("No Windows registry module was found")
     try:
         k=SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE,
                                   'SOFTWARE\\Pharlap\\ETS')
     try:
         k=SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE,
                                   'SOFTWARE\\Pharlap\\ETS')
@@ -61,7 +61,7 @@ def getPharLapPath():
                     
         return os.path.normpath(val)
     except SCons.Util.RegError:
                     
         return os.path.normpath(val)
     except SCons.Util.RegError:
-        raise SCons.Errors.UserError, "Cannot find Phar Lap ETS path in the registry.  Is it installed properly?"
+        raise SCons.Errors.UserError("Cannot find Phar Lap ETS path in the registry.  Is it installed properly?")
 
 REGEX_ETS_VER = re.compile(r'#define\s+ETS_VER\s+([0-9]+)')
 
 
 REGEX_ETS_VER = re.compile(r'#define\s+ETS_VER\s+([0-9]+)')
 
@@ -78,7 +78,7 @@ def getPharLapVersion():
 
     include_path = os.path.join(getPharLapPath(), os.path.normpath("include/embkern.h"))
     if not os.path.exists(include_path):
 
     include_path = os.path.join(getPharLapPath(), os.path.normpath("include/embkern.h"))
     if not os.path.exists(include_path):
-        raise SCons.Errors.UserError, "Cannot find embkern.h in ETS include directory.\nIs Phar Lap ETS installed properly?"
+        raise SCons.Errors.UserError("Cannot find embkern.h in ETS include directory.\nIs Phar Lap ETS installed properly?")
     mo = REGEX_ETS_VER.search(open(include_path, 'r').read())
     if mo:
         return int(mo.group(1))
     mo = REGEX_ETS_VER.search(open(include_path, 'r').read())
     if mo:
         return int(mo.group(1))
index b22fb59fa91f4f72e32983c559ada1495f7c4f42..e068bf5fec7b9b4857b7a92df5e9cf796a30660d 100644 (file)
@@ -114,7 +114,7 @@ class Tool:
                         file.close()
             except ImportError, e:
                 if str(e)!="No module named %s"%self.name:
                         file.close()
             except ImportError, e:
                 if str(e)!="No module named %s"%self.name:
-                    raise SCons.Errors.EnvironmentError, e
+                    raise SCons.Errors.EnvironmentError(e)
                 try:
                     import zipimport
                 except ImportError:
                 try:
                     import zipimport
                 except ImportError:
@@ -144,7 +144,7 @@ class Tool:
                     return module
                 except ImportError, e:
                     if str(e)!="No module named %s"%self.name:
                     return module
                 except ImportError, e:
                     if str(e)!="No module named %s"%self.name:
-                        raise SCons.Errors.EnvironmentError, e
+                        raise SCons.Errors.EnvironmentError(e)
                     try:
                         import zipimport
                         importer = zipimport.zipimporter( sys.modules['SCons.Tool'].__path__[0] )
                     try:
                         import zipimport
                         importer = zipimport.zipimporter( sys.modules['SCons.Tool'].__path__[0] )
@@ -153,10 +153,10 @@ class Tool:
                         return module
                     except ImportError, e:
                         m = "No tool named '%s': %s" % (self.name, e)
                         return module
                     except ImportError, e:
                         m = "No tool named '%s': %s" % (self.name, e)
-                        raise SCons.Errors.EnvironmentError, m
+                        raise SCons.Errors.EnvironmentError(m)
             except ImportError, e:
                 m = "No tool named '%s': %s" % (self.name, e)
             except ImportError, e:
                 m = "No tool named '%s': %s" % (self.name, e)
-                raise SCons.Errors.EnvironmentError, m
+                raise SCons.Errors.EnvironmentError(m)
 
     def __call__(self, env, *args, **kw):
         if self.init_kw is not None:
 
     def __call__(self, env, *args, **kw):
         if self.init_kw is not None:
index abdd4797a9e13609d86ff15d0c9c3e115f4fec93..dde0c98d996519455f75b6b689cb09f75b35277f 100644 (file)
@@ -54,7 +54,7 @@ def copyFunc(dest, source, env):
     if os.path.isdir(source):
         if os.path.exists(dest):
             if not os.path.isdir(dest):
     if os.path.isdir(source):
         if os.path.exists(dest):
             if not os.path.isdir(dest):
-                raise SCons.Errors.UserError, "cannot overwrite non-directory `%s' with a directory `%s'" % (str(dest), str(source))
+                raise SCons.Errors.UserError("cannot overwrite non-directory `%s' with a directory `%s'" % (str(dest), str(source)))
         else:
             parent = os.path.split(dest)[0]
             if not os.path.exists(parent):
         else:
             parent = os.path.split(dest)[0]
             if not os.path.exists(parent):
@@ -135,7 +135,7 @@ BaseInstallBuilder               = None
 def InstallBuilderWrapper(env, target=None, source=None, dir=None, **kw):
     if target and dir:
         import SCons.Errors
 def InstallBuilderWrapper(env, target=None, source=None, dir=None, **kw):
     if target and dir:
         import SCons.Errors
-        raise SCons.Errors.UserError, "Both target and dir defined for Install(), only one may be defined."
+        raise SCons.Errors.UserError("Both target and dir defined for Install(), only one may be defined.")
     if not dir:
         dir=target
 
     if not dir:
         dir=target
 
@@ -149,7 +149,7 @@ def InstallBuilderWrapper(env, target=None, source=None, dir=None, **kw):
     try:
         dnodes = env.arg2nodes(dir, target_factory.Dir)
     except TypeError:
     try:
         dnodes = env.arg2nodes(dir, target_factory.Dir)
     except TypeError:
-        raise SCons.Errors.UserError, "Target `%s' of Install() is a file, but should be a directory.  Perhaps you have the Install() arguments backwards?" % str(dir)
+        raise SCons.Errors.UserError("Target `%s' of Install() is a file, but should be a directory.  Perhaps you have the Install() arguments backwards?" % str(dir))
     sources = env.arg2nodes(source, env.fs.Entry)
     tgt = []
     for dnode in dnodes:
     sources = env.arg2nodes(source, env.fs.Entry)
     tgt = []
     for dnode in dnodes:
index 1cc13127533d23fd83fe2861503f52edc4f8cae2..fffda70bf51cb97ccf8063bbcc41c3813862bc4d 100644 (file)
@@ -117,9 +117,8 @@ def check_abi(abi):
     try:
         abi = valid_abis[abi]
     except KeyError:
     try:
         abi = valid_abis[abi]
     except KeyError:
-        raise SCons.Errors.UserError, \
-              "Intel compiler: Invalid ABI %s, valid values are %s"% \
-              (abi, valid_abis.keys())
+        raise SCons.Errors.UserError("Intel compiler: Invalid ABI %s, valid values are %s"% \
+              (abi, valid_abis.keys()))
     return abi
 
 def vercmp(a, b):
     return abi
 
 def vercmp(a, b):
@@ -156,16 +155,14 @@ def get_intel_registry_value(valuename, version=None, abi=None):
     try:
         k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, K)
     except SCons.Util.RegError:
     try:
         k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, K)
     except SCons.Util.RegError:
-        raise MissingRegistryError, \
-              "%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi)
+        raise MissingRegistryError("%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi))
 
     # Get the value:
     try:
         v = SCons.Util.RegQueryValueEx(k, valuename)[0]
         return v  # or v.encode('iso-8859-1', 'replace') to remove unicode?
     except SCons.Util.RegError:
 
     # Get the value:
     try:
         v = SCons.Util.RegQueryValueEx(k, valuename)[0]
         return v  # or v.encode('iso-8859-1', 'replace') to remove unicode?
     except SCons.Util.RegError:
-        raise MissingRegistryError, \
-              "%s\\%s was not found in the registry."%(K, valuename)
+        raise MissingRegistryError("%s\\%s was not found in the registry."%(K, valuename))
 
 
 def get_all_compiler_versions():
 
 
 def get_all_compiler_versions():
@@ -255,13 +252,12 @@ def get_intel_compiler_top(version, abi):
 
     if is_windows:
         if not SCons.Util.can_read_reg:
 
     if is_windows:
         if not SCons.Util.can_read_reg:
-            raise NoRegistryModuleError, "No Windows registry module was found"
+            raise NoRegistryModuleError("No Windows registry module was found")
         top = get_intel_registry_value('ProductDir', version, abi)
         # pre-11, icl was in Bin.  11 and later, it's in Bin/<abi> apparently.
         if not os.path.exists(os.path.join(top, "Bin", "icl.exe")) \
               and not os.path.exists(os.path.join(top, "Bin", abi, "icl.exe")):
         top = get_intel_registry_value('ProductDir', version, abi)
         # pre-11, icl was in Bin.  11 and later, it's in Bin/<abi> apparently.
         if not os.path.exists(os.path.join(top, "Bin", "icl.exe")) \
               and not os.path.exists(os.path.join(top, "Bin", abi, "icl.exe")):
-            raise MissingDirError, \
-                  "Can't find Intel compiler in %s"%(top)
+            raise MissingDirError("Can't find Intel compiler in %s"%(top))
     elif is_mac or is_linux:
         # first dir is new (>=9.0) style, second is old (8.0) style.
         dirs=('/opt/intel/cc/%s', '/opt/intel_cc_%s')
     elif is_mac or is_linux:
         # first dir is new (>=9.0) style, second is old (8.0) style.
         dirs=('/opt/intel/cc/%s', '/opt/intel_cc_%s')
@@ -273,8 +269,7 @@ def get_intel_compiler_top(version, abi):
                 top = d%version
                 break
         if not top:
                 top = d%version
                 break
         if not top:
-            raise MissingDirError, \
-                  "Can't find version %s Intel compiler in %s (abi='%s')"%(version,top, abi)
+            raise MissingDirError("Can't find version %s Intel compiler in %s (abi='%s')"%(version,top, abi))
     return top
 
 
     return top
 
 
@@ -310,9 +305,8 @@ def generate(env, version=None, abi=None, topdir=None, verbose=0):
         # get_version_from_list does that mapping.
         v = get_version_from_list(version, vlist)
         if not v:
         # get_version_from_list does that mapping.
         v = get_version_from_list(version, vlist)
         if not v:
-            raise SCons.Errors.UserError, \
-                  "Invalid Intel compiler version %s: "%version + \
-                  "installed versions are %s"%(', '.join(vlist))
+            raise SCons.Errors.UserError("Invalid Intel compiler version %s: "%version + \
+                  "installed versions are %s"%(', '.join(vlist)))
         version = v
 
     # if abi is unspecified, use ia32
         version = v
 
     # if abi is unspecified, use ia32
index 8d40a0bc2ebd3bcd58013e03ada21c0f915276ab..98156dd25ff2ee726e3f7ca1211c242da18ba6bb 100644 (file)
@@ -72,7 +72,7 @@ def shlib_emitter(target, source, env):
     no_import_lib = env.get('no_import_lib', 0)
 
     if not dll:
     no_import_lib = env.get('no_import_lib', 0)
 
     if not dll:
-        raise SCons.Errors.UserError, "A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX")
+        raise SCons.Errors.UserError("A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX"))
     
     if not no_import_lib and \
        not env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX'):
     
     if not no_import_lib and \
        not env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX'):
index b1ba1df02363c347cc84c07050ca32c240f5cfe2..e0eec8c2302fdaec9627e2de7efeab707e73403c 100644 (file)
@@ -103,7 +103,7 @@ def _dllEmitter(target, source, env, paramtp):
     no_import_lib = env.get('no_import_lib', 0)
 
     if not dll:
     no_import_lib = env.get('no_import_lib', 0)
 
     if not dll:
-        raise SCons.Errors.UserError, 'A shared library should have exactly one target with the suffix: %s' % env.subst('$%sSUFFIX' % paramtp)
+        raise SCons.Errors.UserError('A shared library should have exactly one target with the suffix: %s' % env.subst('$%sSUFFIX' % paramtp))
 
     insert_def = env.subst("$WINDOWS_INSERT_DEF")
     if not insert_def in ['', '0', 0] and \
 
     insert_def = env.subst("$WINDOWS_INSERT_DEF")
     if not insert_def in ['', '0', 0] and \
@@ -161,7 +161,7 @@ def prog_emitter(target, source, env):
 
     exe = env.FindIxes(target, "PROGPREFIX", "PROGSUFFIX")
     if not exe:
 
     exe = env.FindIxes(target, "PROGPREFIX", "PROGSUFFIX")
     if not exe:
-        raise SCons.Errors.UserError, "An executable should have exactly one target with the suffix: %s" % env.subst("$PROGSUFFIX")
+        raise SCons.Errors.UserError("An executable should have exactly one target with the suffix: %s" % env.subst("$PROGSUFFIX"))
 
     version_num, suite = SCons.Tool.msvs.msvs_parse_version(env.get('MSVS_VERSION', '6.0'))
     if version_num >= 8.0 and env.get('WINDOWS_INSERT_MANIFEST', 0):
 
     version_num, suite = SCons.Tool.msvs.msvs_parse_version(env.get('MSVS_VERSION', '6.0'))
     if version_num >= 8.0 and env.get('WINDOWS_INSERT_MANIFEST', 0):
@@ -182,7 +182,7 @@ def RegServerFunc(target, source, env):
     if 'register' in env and env['register']:
         ret = regServerAction([target[0]], [source[0]], env)
         if ret:
     if 'register' in env and env['register']:
         ret = regServerAction([target[0]], [source[0]], env)
         if ret:
-            raise SCons.Errors.UserError, "Unable to register %s" % target[0]
+            raise SCons.Errors.UserError("Unable to register %s" % target[0])
         else:
             print "Registered %s sucessfully" % target[0]
         return ret
         else:
             print "Registered %s sucessfully" % target[0]
         return ret
index fde93ea81a27f922cc4aafb1bac684a20c75c1b1..41e793aade6a7c5c807140c39bb95cedfa692f9e 100644 (file)
@@ -56,9 +56,9 @@ def validate_vars(env):
     """Validate the PCH and PCHSTOP construction variables."""
     if 'PCH' in env and env['PCH']:
         if 'PCHSTOP' not in env:
     """Validate the PCH and PCHSTOP construction variables."""
     if 'PCH' in env and env['PCH']:
         if 'PCHSTOP' not in env:
-            raise SCons.Errors.UserError, "The PCHSTOP construction must be defined if PCH is defined."
+            raise SCons.Errors.UserError("The PCHSTOP construction must be defined if PCH is defined.")
         if not SCons.Util.is_String(env['PCHSTOP']):
         if not SCons.Util.is_String(env['PCHSTOP']):
-            raise SCons.Errors.UserError, "The PCHSTOP construction variable must be a string: %r"%env['PCHSTOP']
+            raise SCons.Errors.UserError("The PCHSTOP construction variable must be a string: %r"%env['PCHSTOP'])
 
 def pch_emitter(target, source, env):
     """Adds the object file target."""
 
 def pch_emitter(target, source, env):
     """Adds the object file target."""
index 698648853cca8dd14cc62881721420979919756c..304c35ea863bc78f9dd3eb40c106076837156ec1 100644 (file)
@@ -177,9 +177,8 @@ class _DSPGenerator:
             self.dspabs = get_abspath()
 
         if 'variant' not in env:
             self.dspabs = get_abspath()
 
         if 'variant' not in env:
-            raise SCons.Errors.InternalError, \
-                  "You must specify a 'variant' argument (i.e. 'Debug' or " +\
-                  "'Release') to create an MSVSProject."
+            raise SCons.Errors.InternalError("You must specify a 'variant' argument (i.e. 'Debug' or " +\
+                  "'Release') to create an MSVSProject.")
         elif SCons.Util.is_String(env['variant']):
             variants = [env['variant']]
         elif SCons.Util.is_List(env['variant']):
         elif SCons.Util.is_String(env['variant']):
             variants = [env['variant']]
         elif SCons.Util.is_List(env['variant']):
@@ -191,8 +190,7 @@ class _DSPGenerator:
             buildtarget = [env['buildtarget']]
         elif SCons.Util.is_List(env['buildtarget']):
             if len(env['buildtarget']) != len(variants):
             buildtarget = [env['buildtarget']]
         elif SCons.Util.is_List(env['buildtarget']):
             if len(env['buildtarget']) != len(variants):
-                raise SCons.Errors.InternalError, \
-                    "Sizes of 'buildtarget' and 'variant' lists must be the same."
+                raise SCons.Errors.InternalError("Sizes of 'buildtarget' and 'variant' lists must be the same.")
             buildtarget = []
             for bt in env['buildtarget']:
                 if SCons.Util.is_String(bt):
             buildtarget = []
             for bt in env['buildtarget']:
                 if SCons.Util.is_String(bt):
@@ -213,8 +211,7 @@ class _DSPGenerator:
             outdir = [env['outdir']]
         elif SCons.Util.is_List(env['outdir']):
             if len(env['outdir']) != len(variants):
             outdir = [env['outdir']]
         elif SCons.Util.is_List(env['outdir']):
             if len(env['outdir']) != len(variants):
-                raise SCons.Errors.InternalError, \
-                    "Sizes of 'outdir' and 'variant' lists must be the same."
+                raise SCons.Errors.InternalError("Sizes of 'outdir' and 'variant' lists must be the same.")
             outdir = []
             for s in env['outdir']:
                 if SCons.Util.is_String(s):
             outdir = []
             for s in env['outdir']:
                 if SCons.Util.is_String(s):
@@ -235,8 +232,7 @@ class _DSPGenerator:
             runfile = [env['runfile']]
         elif SCons.Util.is_List(env['runfile']):
             if len(env['runfile']) != len(variants):
             runfile = [env['runfile']]
         elif SCons.Util.is_List(env['runfile']):
             if len(env['runfile']) != len(variants):
-                raise SCons.Errors.InternalError, \
-                    "Sizes of 'runfile' and 'variant' lists must be the same."
+                raise SCons.Errors.InternalError("Sizes of 'runfile' and 'variant' lists must be the same.")
             runfile = []
             for s in env['runfile']:
                 if SCons.Util.is_String(s):
             runfile = []
             for s in env['runfile']:
                 if SCons.Util.is_String(s):
@@ -521,7 +517,7 @@ class _GenerateV6DSP(_DSPGenerator):
         try:
             self.file = open(self.dspabs,'w')
         except IOError, detail:
         try:
             self.file = open(self.dspabs,'w')
         except IOError, detail:
-            raise SCons.Errors.InternalError, 'Unable to open "' + self.dspabs + '" for writing:' + str(detail)
+            raise SCons.Errors.InternalError('Unable to open "' + self.dspabs + '" for writing:' + str(detail))
         else:
             self.PrintHeader()
             self.PrintProject()
         else:
             self.PrintHeader()
             self.PrintProject()
@@ -825,7 +821,7 @@ class _GenerateV7DSP(_DSPGenerator):
         try:
             self.file = open(self.dspabs,'w')
         except IOError, detail:
         try:
             self.file = open(self.dspabs,'w')
         except IOError, detail:
-            raise SCons.Errors.InternalError, 'Unable to open "' + self.dspabs + '" for writing:' + str(detail)
+            raise SCons.Errors.InternalError('Unable to open "' + self.dspabs + '" for writing:' + str(detail))
         else:
             self.PrintHeader()
             self.PrintProject()
         else:
             self.PrintHeader()
             self.PrintProject()
@@ -838,16 +834,13 @@ class _DSWGenerator:
         self.env = env
 
         if 'projects' not in env:
         self.env = env
 
         if 'projects' not in env:
-            raise SCons.Errors.UserError, \
-                "You must specify a 'projects' argument to create an MSVSSolution."
+            raise SCons.Errors.UserError("You must specify a 'projects' argument to create an MSVSSolution.")
         projects = env['projects']
         if not SCons.Util.is_List(projects):
         projects = env['projects']
         if not SCons.Util.is_List(projects):
-            raise SCons.Errors.InternalError, \
-                "The 'projects' argument must be a list of nodes."
+            raise SCons.Errors.InternalError("The 'projects' argument must be a list of nodes.")
         projects = SCons.Util.flatten(projects)
         if len(projects) < 1:
         projects = SCons.Util.flatten(projects)
         if len(projects) < 1:
-            raise SCons.Errors.UserError, \
-                "You must specify at least one project to create an MSVSSolution."
+            raise SCons.Errors.UserError("You must specify at least one project to create an MSVSSolution.")
         self.dspfiles = list(map(str, projects))
 
         if 'name' in self.env:
         self.dspfiles = list(map(str, projects))
 
         if 'name' in self.env:
@@ -904,9 +897,8 @@ class _GenerateV7DSW(_DSWGenerator):
             print "Adding '" + self.name + ' - ' + config.variant + '|' + config.platform + "' to '" + str(dswfile) + "'"
 
         if 'variant' not in env:
             print "Adding '" + self.name + ' - ' + config.variant + '|' + config.platform + "' to '" + str(dswfile) + "'"
 
         if 'variant' not in env:
-            raise SCons.Errors.InternalError, \
-                  "You must specify a 'variant' argument (i.e. 'Debug' or " +\
-                  "'Release') to create an MSVS Solution File."
+            raise SCons.Errors.InternalError("You must specify a 'variant' argument (i.e. 'Debug' or " +\
+                  "'Release') to create an MSVS Solution File.")
         elif SCons.Util.is_String(env['variant']):
             AddConfig(self, env['variant'])
         elif SCons.Util.is_List(env['variant']):
         elif SCons.Util.is_String(env['variant']):
             AddConfig(self, env['variant'])
         elif SCons.Util.is_List(env['variant']):
@@ -1053,7 +1045,7 @@ class _GenerateV7DSW(_DSWGenerator):
         try:
             self.file = open(self.dswfile,'w')
         except IOError, detail:
         try:
             self.file = open(self.dswfile,'w')
         except IOError, detail:
-            raise SCons.Errors.InternalError, 'Unable to open "' + self.dswfile + '" for writing:' + str(detail)
+            raise SCons.Errors.InternalError('Unable to open "' + self.dswfile + '" for writing:' + str(detail))
         else:
             self.PrintSolution()
             self.file.close()
         else:
             self.PrintSolution()
             self.file.close()
@@ -1102,7 +1094,7 @@ class _GenerateV6DSW(_DSWGenerator):
         try:
             self.file = open(self.dswfile,'w')
         except IOError, detail:
         try:
             self.file = open(self.dswfile,'w')
         except IOError, detail:
-            raise SCons.Errors.InternalError, 'Unable to open "' + self.dswfile + '" for writing:' + str(detail)
+            raise SCons.Errors.InternalError('Unable to open "' + self.dswfile + '" for writing:' + str(detail))
         else:
             self.PrintWorkspace()
             self.file.close()
         else:
             self.PrintWorkspace()
             self.file.close()
@@ -1210,12 +1202,10 @@ def projectEmitter(target, source, env):
                         source = source + ' "%s"' % bt
                     else:
                         try: source = source + ' "%s"' % bt.get_abspath()
                         source = source + ' "%s"' % bt
                     else:
                         try: source = source + ' "%s"' % bt.get_abspath()
-                        except AttributeError: raise SCons.Errors.InternalError, \
-                            "buildtarget can be a string, a node, a list of strings or nodes, or None"
+                        except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None")
             else:
                 try: source = source + ' "%s"' % env['buildtarget'].get_abspath()
             else:
                 try: source = source + ' "%s"' % env['buildtarget'].get_abspath()
-                except AttributeError: raise SCons.Errors.InternalError, \
-                    "buildtarget can be a string, a node, a list of strings or nodes, or None"
+                except AttributeError: raise SCons.Errors.InternalError("buildtarget can be a string, a node, a list of strings or nodes, or None")
 
         if 'outdir' in env and env['outdir'] != None:
             if SCons.Util.is_String(env['outdir']):
 
         if 'outdir' in env and env['outdir'] != None:
             if SCons.Util.is_String(env['outdir']):
@@ -1226,18 +1216,16 @@ def projectEmitter(target, source, env):
                         source = source + ' "%s"' % s
                     else:
                         try: source = source + ' "%s"' % s.get_abspath()
                         source = source + ' "%s"' % s
                     else:
                         try: source = source + ' "%s"' % s.get_abspath()
-                        except AttributeError: raise SCons.Errors.InternalError, \
-                            "outdir can be a string, a node, a list of strings or nodes, or None"
+                        except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None")
             else:
                 try: source = source + ' "%s"' % env['outdir'].get_abspath()
             else:
                 try: source = source + ' "%s"' % env['outdir'].get_abspath()
-                except AttributeError: raise SCons.Errors.InternalError, \
-                    "outdir can be a string, a node, a list of strings or nodes, or None"
+                except AttributeError: raise SCons.Errors.InternalError("outdir can be a string, a node, a list of strings or nodes, or None")
 
         if 'name' in env:
             if SCons.Util.is_String(env['name']):
                 source = source + ' "%s"' % env['name']
             else:
 
         if 'name' in env:
             if SCons.Util.is_String(env['name']):
                 source = source + ' "%s"' % env['name']
             else:
-                raise SCons.Errors.InternalError, "name must be a string"
+                raise SCons.Errors.InternalError("name must be a string")
 
         if 'variant' in env:
             if SCons.Util.is_String(env['variant']):
 
         if 'variant' in env:
             if SCons.Util.is_String(env['variant']):
@@ -1247,11 +1235,11 @@ def projectEmitter(target, source, env):
                     if SCons.Util.is_String(variant):
                         source = source + ' "%s"' % variant
                     else:
                     if SCons.Util.is_String(variant):
                         source = source + ' "%s"' % variant
                     else:
-                        raise SCons.Errors.InternalError, "name must be a string or a list of strings"
+                        raise SCons.Errors.InternalError("name must be a string or a list of strings")
             else:
             else:
-                raise SCons.Errors.InternalError, "variant must be a string or a list of strings"
+                raise SCons.Errors.InternalError("variant must be a string or a list of strings")
         else:
         else:
-            raise SCons.Errors.InternalError, "variant must be specified"
+            raise SCons.Errors.InternalError("variant must be specified")
 
         for s in _DSPGenerator.srcargs:
             if s in env:
 
         for s in _DSPGenerator.srcargs:
             if s in env:
@@ -1262,9 +1250,9 @@ def projectEmitter(target, source, env):
                         if SCons.Util.is_String(t):
                             source = source + ' "%s"' % t
                         else:
                         if SCons.Util.is_String(t):
                             source = source + ' "%s"' % t
                         else:
-                            raise SCons.Errors.InternalError, s + " must be a string or a list of strings"
+                            raise SCons.Errors.InternalError(s + " must be a string or a list of strings")
                 else:
                 else:
-                    raise SCons.Errors.InternalError, s + " must be a string or a list of strings"
+                    raise SCons.Errors.InternalError(s + " must be a string or a list of strings")
 
         source = source + ' "%s"' % str(target[0])
         source = [SCons.Node.Python.Value(source)]
 
         source = source + ' "%s"' % str(target[0])
         source = [SCons.Node.Python.Value(source)]
@@ -1300,7 +1288,7 @@ def solutionEmitter(target, source, env):
             if SCons.Util.is_String(env['name']):
                 source = source + ' "%s"' % env['name']
             else:
             if SCons.Util.is_String(env['name']):
                 source = source + ' "%s"' % env['name']
             else:
-                raise SCons.Errors.InternalError, "name must be a string"
+                raise SCons.Errors.InternalError("name must be a string")
 
         if 'variant' in env:
             if SCons.Util.is_String(env['variant']):
 
         if 'variant' in env:
             if SCons.Util.is_String(env['variant']):
@@ -1310,17 +1298,17 @@ def solutionEmitter(target, source, env):
                     if SCons.Util.is_String(variant):
                         source = source + ' "%s"' % variant
                     else:
                     if SCons.Util.is_String(variant):
                         source = source + ' "%s"' % variant
                     else:
-                        raise SCons.Errors.InternalError, "name must be a string or a list of strings"
+                        raise SCons.Errors.InternalError("name must be a string or a list of strings")
             else:
             else:
-                raise SCons.Errors.InternalError, "variant must be a string or a list of strings"
+                raise SCons.Errors.InternalError("variant must be a string or a list of strings")
         else:
         else:
-            raise SCons.Errors.InternalError, "variant must be specified"
+            raise SCons.Errors.InternalError("variant must be specified")
 
         if 'slnguid' in env:
             if SCons.Util.is_String(env['slnguid']):
                 source = source + ' "%s"' % env['slnguid']
             else:
 
         if 'slnguid' in env:
             if SCons.Util.is_String(env['slnguid']):
                 source = source + ' "%s"' % env['slnguid']
             else:
-                raise SCons.Errors.InternalError, "slnguid must be a string"
+                raise SCons.Errors.InternalError("slnguid must be a string")
 
         if 'projects' in env:
             if SCons.Util.is_String(env['projects']):
 
         if 'projects' in env:
             if SCons.Util.is_String(env['projects']):
index e84b8127ce4981b9f1518fe211f536f48dbd924a..e762d55918b744e063fd3bb7006b699eecf9a3e8 100644 (file)
@@ -85,7 +85,7 @@ def shlib_emitter(target, source, env):
     no_import_lib = env.get('no_import_lib', 0)
 
     if not dll:
     no_import_lib = env.get('no_import_lib', 0)
 
     if not dll:
-        raise SCons.Errors.UserError, "A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX")
+        raise SCons.Errors.UserError("A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX"))
 
     if not no_import_lib and \
        not env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX'):
 
     if not no_import_lib and \
        not env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX'):
index b80f12814d58e55b74582f9112ba50d700ebdb3c..462228f79d3a34992a5bb52f47cc57ecb4b88d12 100644 (file)
@@ -59,7 +59,7 @@ def Tag(env, target, source, *more_tags, **kw_tags):
         kw_tags[first_tag[0]] = ''
 
     if len(kw_tags) == 0 and len(more_tags) == 0:
         kw_tags[first_tag[0]] = ''
 
     if len(kw_tags) == 0 and len(more_tags) == 0:
-        raise UserError, "No tags given."
+        raise UserError("No tags given.")
 
     # XXX: sanity checks
     for x in more_tags:
 
     # XXX: sanity checks
     for x in more_tags:
@@ -92,7 +92,7 @@ def Package(env, target=None, source=None, **kw):
         source = env.FindInstalledFiles()
 
     if len(source)==0:
         source = env.FindInstalledFiles()
 
     if len(source)==0:
-        raise UserError, "No source for Package() given"
+        raise UserError("No source for Package() given")
 
     # decide which types of packages shall be built. Can be defined through
     # four mechanisms: command line argument, keyword argument,
 
     # decide which types of packages shall be built. Can be defined through
     # four mechanisms: command line argument, keyword argument,
@@ -111,7 +111,7 @@ def Package(env, target=None, source=None, **kw):
         elif 'Zip' in env['BUILDERS']:
             kw['PACKAGETYPE']='zip'
         else:
         elif 'Zip' in env['BUILDERS']:
             kw['PACKAGETYPE']='zip'
         else:
-            raise UserError, "No type for Package() given"
+            raise UserError("No type for Package() given")
 
     PACKAGETYPE=kw['PACKAGETYPE']
     if not is_List(PACKAGETYPE):
 
     PACKAGETYPE=kw['PACKAGETYPE']
     if not is_List(PACKAGETYPE):
index 6816af07e3985f95c868f58f4724d143e9f52ae7..d61db37eebd20205751f93b150885a1ea50daae3 100644 (file)
@@ -1136,7 +1136,7 @@ class Selector(OrderedDict):
                         # to the same suffix.  If one suffix is literal
                         # and a variable suffix contains this literal,
                         # the literal wins and we don't raise an error.
                         # to the same suffix.  If one suffix is literal
                         # and a variable suffix contains this literal,
                         # the literal wins and we don't raise an error.
-                        raise KeyError(s_dict[s_k][0], k, s_k)
+                        raise KeyError(s_dict[s_k][0], k, s_k)
                     s_dict[s_k] = (k,v)
             try:
                 return s_dict[ext][1]
                     s_dict[s_k] = (k,v)
             try:
                 return s_dict[ext][1]
index e044065362854d0bb63557f4108c862a6d4a3ad7..15ee2a6f88e32e696e55d01fb5a0241ac1884372 100644 (file)
@@ -774,7 +774,7 @@ class NodeListTestCase(unittest.TestCase):
         r = str(nl)
         assert r == '', r
         for node in nl:
         r = str(nl)
         assert r == '', r
         for node in nl:
-            raise Exception, "should not enter this loop"
+            raise Exception("should not enter this loop")
 
 
 class flattenTestCase(unittest.TestCase):
 
 
 class flattenTestCase(unittest.TestCase):
index 164325220f333fdb27c3e62d965aca580b1a3cc5..084154bdf326389bc85bce6d634e3c90dd2168ca 100644 (file)
@@ -68,7 +68,7 @@ class PathVariableTestCase(unittest.TestCase):
         except SCons.Errors.UserError, e:
             assert str(e) == 'Path for option X does not exist: %s' % dne, e
         except:
         except SCons.Errors.UserError, e:
             assert str(e) == 'Path for option X does not exist: %s' % dne, e
         except:
-            raise "did not catch expected UserError"
+            raise Exception("did not catch expected UserError")
 
     def test_PathIsDir(self):
         """Test the PathIsDir validator"""
 
     def test_PathIsDir(self):
         """Test the PathIsDir validator"""
@@ -92,7 +92,7 @@ class PathVariableTestCase(unittest.TestCase):
         except SCons.Errors.UserError, e:
             assert str(e) == 'Directory path for option X is a file: %s' % f, e
         except:
         except SCons.Errors.UserError, e:
             assert str(e) == 'Directory path for option X is a file: %s' % f, e
         except:
-            raise "did not catch expected UserError"
+            raise Exception("did not catch expected UserError")
 
         dne = test.workpath('does_not_exist')
         try:
 
         dne = test.workpath('does_not_exist')
         try:
@@ -100,7 +100,7 @@ class PathVariableTestCase(unittest.TestCase):
         except SCons.Errors.UserError, e:
             assert str(e) == 'Directory path for option X does not exist: %s' % dne, e
         except:
         except SCons.Errors.UserError, e:
             assert str(e) == 'Directory path for option X does not exist: %s' % dne, e
         except:
-            raise "did not catch expected UserError"
+            raise Exception("did not catch expected UserError")
 
     def test_PathIsDirCreate(self):
         """Test the PathIsDirCreate validator"""
 
     def test_PathIsDirCreate(self):
         """Test the PathIsDirCreate validator"""
@@ -125,7 +125,7 @@ class PathVariableTestCase(unittest.TestCase):
         except SCons.Errors.UserError, e:
             assert str(e) == 'Path for option X is a file, not a directory: %s' % f, e
         except:
         except SCons.Errors.UserError, e:
             assert str(e) == 'Path for option X is a file, not a directory: %s' % f, e
         except:
-            raise "did not catch expected UserError"
+            raise Exception("did not catch expected UserError")
 
     def test_PathIsFile(self):
         """Test the PathIsFile validator"""
 
     def test_PathIsFile(self):
         """Test the PathIsFile validator"""
@@ -149,7 +149,7 @@ class PathVariableTestCase(unittest.TestCase):
         except SCons.Errors.UserError, e:
             assert str(e) == 'File path for option X does not exist: %s' % d, e
         except:
         except SCons.Errors.UserError, e:
             assert str(e) == 'File path for option X does not exist: %s' % d, e
         except:
-            raise "did not catch expected UserError"
+            raise Exception("did not catch expected UserError")
 
         dne = test.workpath('does_not_exist')
         try:
 
         dne = test.workpath('does_not_exist')
         try:
@@ -157,7 +157,7 @@ class PathVariableTestCase(unittest.TestCase):
         except SCons.Errors.UserError, e:
             assert str(e) == 'File path for option X does not exist: %s' % dne, e
         except:
         except SCons.Errors.UserError, e:
             assert str(e) == 'File path for option X does not exist: %s' % dne, e
         except:
-            raise "did not catch expected UserError"
+            raise Exception("did not catch expected UserError")
 
     def test_PathAccept(self):
         """Test the PathAccept validator"""
 
     def test_PathAccept(self):
         """Test the PathAccept validator"""
@@ -202,10 +202,10 @@ class PathVariableTestCase(unittest.TestCase):
             expect = 'Path for option X does not exist: %s' % dne
             assert str(e) == expect, e
         else:
             expect = 'Path for option X does not exist: %s' % dne
             assert str(e) == expect, e
         else:
-            raise "did not catch expected UserError"
+            raise Exception("did not catch expected UserError")
 
         def my_validator(key, val, env):
 
         def my_validator(key, val, env):
-            raise Exception, "my_validator() got called for %s, %s!" % (key, val)
+            raise Exception("my_validator() got called for %s, %s!" % (key, val))
 
         opts = SCons.Variables.Variables()
         opts.Add(SCons.Variables.PathVariable('test2',
 
         opts = SCons.Variables.Variables()
         opts.Add(SCons.Variables.PathVariable('test2',
@@ -220,7 +220,7 @@ class PathVariableTestCase(unittest.TestCase):
         except Exception, e:
             assert str(e) == 'my_validator() got called for Y, value!', e
         else:
         except Exception, e:
             assert str(e) == 'my_validator() got called for Y, value!', e
         else:
-            raise "did not catch expected exception from my_validator()"
+            raise Exception("did not catch expected exception from my_validator()")
 
 
 
 
 
 
index 09d4e29af7948cdacb23cb7d224b74994739c0a9..171c09805edef7998cb44267bc8ad82fae9ab60e 100644 (file)
@@ -129,7 +129,7 @@ class Variables:
 
         if not SCons.Util.is_String(key) or \
            not SCons.Environment.is_valid_construction_var(key):
 
         if not SCons.Util.is_String(key) or \
            not SCons.Environment.is_valid_construction_var(key):
-            raise SCons.Errors.UserError, "Illegal Variables.Add() key `%s'" % str(key)
+            raise SCons.Errors.UserError("Illegal Variables.Add() key `%s'" % str(key))
 
         self._do_add(key, help, default, validator, converter)
 
 
         self._do_add(key, help, default, validator, converter)
 
@@ -211,7 +211,7 @@ class Variables:
                     except TypeError:
                         env[option.key] = option.converter(value, env)
                 except ValueError, x:
                     except TypeError:
                         env[option.key] = option.converter(value, env)
                 except ValueError, x:
-                    raise SCons.Errors.UserError, 'Error converting option: %s\n%s'%(option.key, x)
+                    raise SCons.Errors.UserError('Error converting option: %s\n%s'%(option.key, x))
 
 
         # Finally validate the values:
 
 
         # Finally validate the values:
@@ -273,7 +273,7 @@ class Variables:
                 fh.close()
 
         except IOError, x:
                 fh.close()
 
         except IOError, x:
-            raise SCons.Errors.UserError, 'Error writing options to file: %s\n%s' % (filename, x)
+            raise SCons.Errors.UserError('Error writing options to file: %s\n%s' % (filename, x))
 
     def GenerateHelpText(self, env, sort=None):
         """
 
     def GenerateHelpText(self, env, sort=None):
         """
index 1792dc48a244685ac2e04766704c034f02b0e2b0..a68ef72ef3db2944ec774f62ed2607342d1a9106 100644 (file)
@@ -308,7 +308,7 @@ except AttributeError:
         except OSError:
             if os.path.isdir(src):
                 if shutil.destinsrc(src, dst):
         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:
                 shutil.copytree(src, dst, symlinks=True)
                 shutil.rmtree(src)
             else:
index 66a325532ddb823a1e955d27cf85195d640251ca..102304a79d7bd1e6b60b35bffa4d4e07b69d3c61 100644 (file)
@@ -42,7 +42,7 @@ class md5obj:
 
     def __init__(self, name, string=''):
         if not name in ('MD5', 'md5'):
 
     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()
 
         self.name = 'md5'
         self.m = self.md5_module.md5()
 
index 9c3df525aff62cd10779233820e86b4d25e5b257..db6fd0d2cdd455bb13fd995da7c44cb540974db3 100644 (file)
@@ -257,10 +257,10 @@ class HelpFormatter:
         self.level = self.level - 1
 
     def format_usage(self, usage):
         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):
 
     def format_heading(self, heading):
-        raise NotImplementedError, "subclasses must implement"
+        raise NotImplementedError("subclasses must implement")
 
     def _format_text(self, text):
         """
 
     def _format_text(self, text):
         """
@@ -831,7 +831,7 @@ class Option:
             parser.print_version()
             parser.exit()
         else:
             parser.print_version()
             parser.exit()
         else:
-            raise RuntimeError, "unknown action %r" % self.action
+            raise RuntimeError("unknown action %r" % self.action)
 
         return 1
 
 
         return 1
 
@@ -902,7 +902,7 @@ class Values:
         elif mode == "loose":
             self._update_loose(dict)
         else:
         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)
 
     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"):
 
     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):
         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):
         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:
         else:
-            raise TypeError, "invalid arguments"
+            raise TypeError("invalid arguments")
 
         self._check_conflict(option)
 
 
         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):
         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:
             if group.parser is not self:
-                raise ValueError, "invalid OptionGroup (wrong parser)"
+                raise ValueError("invalid OptionGroup (wrong parser)")
         else:
         else:
-            raise TypeError, "invalid arguments"
+            raise TypeError("invalid arguments")
 
         self.option_groups.append(group)
         return group
 
         self.option_groups.append(group)
         return group
index 765867b0bd2fb95926a7ea46bdf8c5b27952238e..211ff161edb29d979ffa709700dbfab761a623bf 100644 (file)
@@ -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:
         """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__
                               "Use Set or ImmutableSet.")
 
     # Standard protocols: __len__, __repr__, __str__, __iter__
@@ -130,7 +130,7 @@ class BaseSet(object):
     # case).
 
     def __cmp__(self, other):
     # 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,
 
     # 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):
         # 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
 
     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
     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,
 
     # In-place union, intersection, differences.
     # Subtle:  The xyz_update() functions deliberately return None,
index dfca2c1d6e9a824605b17d4a3897f7c7eb1349c0..6ed39cfa1109d151a61e25815e72348cd5f81b1c 100644 (file)
@@ -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?
                     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
                 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?
                     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 \
                 # In posix shells, only the quote itself or the escape
                 # character may be escaped within quotes.
                 if escapedstate in self.quotes and \
index 5e159eca9b6cd3cd2dff7926bc66ed9704eae40c..80b1c8bdf79976e8ef02a26e61dfdcfe9fdb13cf 100644 (file)
@@ -202,7 +202,7 @@ class FunctionEvaluator:
         with the specified values.
         """
         if len(self.args) != len(values):
         with the specified values.
         """
         if len(self.args) != len(values):
-            raise ValueError, "Incorrect number of arguments to `%s'" % self.name
+            raise ValueError("Incorrect number of arguments to `%s'" % self.name)
         # Create a dictionary that maps the macro arguments to the
         # corresponding values in this "call."  We'll use this when we
         # eval() the expansion so that arguments will get expanded to
         # Create a dictionary that maps the macro arguments to the
         # corresponding values in this "call."  We'll use this when we
         # eval() the expansion so that arguments will get expanded to
index 8e40a5f03be12bdb6a3bc75647d0882544ed8819..5acd0f272c7300bad1712385ef09933fc7e40a2f 100644 (file)
@@ -144,9 +144,9 @@ class dblite:
   def __setitem__(self, key, value):
     self._check_writable()
     if (not is_string(key)):
   def __setitem__(self, key, value):
     self._check_writable()
     if (not is_string(key)):
-      raise TypeError, "key `%s' must be a string but is %s" % (key, type(key))
+      raise TypeError("key `%s' must be a string but is %s" % (key, type(key)))
     if (not is_string(value)):
     if (not is_string(value)):
-      raise TypeError, "value `%s' must be a string but is %s" % (value, type(value))
+      raise TypeError("value `%s' must be a string but is %s" % (value, type(value)))
     self._dict[key] = value
     self._needs_sync = 0001
 
     self._dict[key] = value
     self._needs_sync = 0001
 
@@ -198,7 +198,7 @@ def _exercise():
   except IOError, e:
     assert str(e) == "Read-only database: tmp.dblite"
   else:
   except IOError, e:
     assert str(e) == "Read-only database: tmp.dblite"
   else:
-    raise RuntimeError, "IOError expected."
+    raise RuntimeError("IOError expected.")
   db = open("tmp", "w")
   assert len(db) == 4
   db["ping"] = "pong"
   db = open("tmp", "w")
   assert len(db) == 4
   db["ping"] = "pong"
@@ -208,13 +208,13 @@ def _exercise():
   except TypeError, e:
     assert str(e) == "key `(1, 2)' must be a string but is <type 'tuple'>", str(e)
   else:
   except TypeError, e:
     assert str(e) == "key `(1, 2)' must be a string but is <type 'tuple'>", str(e)
   else:
-    raise RuntimeError, "TypeError exception expected"
+    raise RuntimeError("TypeError exception expected")
   try:
     db["list"] = [1,2]
   except TypeError, e:
     assert str(e) == "value `[1, 2]' must be a string but is <type 'list'>", str(e)
   else:
   try:
     db["list"] = [1,2]
   except TypeError, e:
     assert str(e) == "value `[1, 2]' must be a string but is <type 'list'>", str(e)
   else:
-    raise RuntimeError, "TypeError exception expected"
+    raise RuntimeError("TypeError exception expected")
   db = open("tmp", "r")
   assert len(db) == 5
   db = open("tmp", "n")
   db = open("tmp", "r")
   assert len(db) == 5
   db = open("tmp", "n")
@@ -227,7 +227,7 @@ def _exercise():
   except pickle.UnpicklingError:
     pass
   else:
   except pickle.UnpicklingError:
     pass
   else:
-    raise RuntimeError, "pickle exception expected."
+    raise RuntimeError("pickle exception expected.")
   global ignore_corrupt_dbfiles
   ignore_corrupt_dbfiles = 2
   db = open("tmp", "r")
   global ignore_corrupt_dbfiles
   ignore_corrupt_dbfiles = 2
   db = open("tmp", "r")
@@ -238,7 +238,7 @@ def _exercise():
   except IOError, e:
     assert str(e) == "[Errno 2] No such file or directory: 'tmp.dblite'", str(e)
   else:
   except IOError, e:
     assert str(e) == "[Errno 2] No such file or directory: 'tmp.dblite'", str(e)
   else:
-    raise RuntimeError, "IOError expected."
+    raise RuntimeError("IOError expected.")
   print "OK"
 
 if (__name__ == "__main__"):
   print "OK"
 
 if (__name__ == "__main__"):
index 49d9fdd8d7b9936ae1c01f63b8b7ceed154d85a3..8ed6da14076c7c44b179323f193138aa09b43aa1 100644 (file)
@@ -37,7 +37,7 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
 test.write('SConstruct', """
 assert "InternalError" not in globals()
 from SCons.Errors import InternalError
 test.write('SConstruct', """
 assert "InternalError" not in globals()
 from SCons.Errors import InternalError
-raise InternalError, 'error inside'
+raise InternalError('error inside')
 """)
 
 test.run(stdout = "scons: Reading SConscript files ...\ninternal error\n",
 """)
 
 test.run(stdout = "scons: Reading SConscript files ...\ninternal error\n",
@@ -46,7 +46,7 @@ test.run(stdout = "scons: Reading SConscript files ...\ninternal error\n",
   File ".+", line \d+, in .+
   File ".+", line \d+, in .+
   File ".+SConstruct", line \d+, in .+
   File ".+", line \d+, in .+
   File ".+", line \d+, in .+
   File ".+SConstruct", line \d+, in .+
-    raise InternalError, 'error inside'
+    raise InternalError\('error inside'\)
 InternalError: error inside
 """, status=2)
 
 InternalError: error inside
 """, status=2)
 
index 0212a528ed30d46ae924d9a01991be9ee662aafd..669260d5b69875588d2113a3203e04adf3dd0502 100644 (file)
@@ -36,7 +36,7 @@ test = TestSCons.TestSCons(match = TestSCons.match_re_dotall)
 test.write('SConstruct', """
 assert "UserError" not in globals()
 import SCons.Errors
 test.write('SConstruct', """
 assert "UserError" not in globals()
 import SCons.Errors
-raise SCons.Errors.UserError, 'Depends() requires both sources and targets.'
+raise SCons.Errors.UserError('Depends() requires both sources and targets.')
 """)
 
 expect = """
 """)
 
 expect = """
index 1e22931598c94f72aa858337812c66f396b56996..5af7ac3c98107101fd924e1846d595b011b1e153 100644 (file)
@@ -47,7 +47,7 @@ def kfile_scan(node, env, target, arg):
     contents = node.get_text_contents()
     exceptions = exception_re.findall(contents)
     if exceptions:
     contents = node.get_text_contents()
     exceptions = exception_re.findall(contents)
     if exceptions:
-        raise Exception, "kfile_scan error:  %s" % exceptions[0]
+        raise Exception("kfile_scan error:  %s" % exceptions[0])
     includes = include_re.findall(contents)
     return includes
 
     includes = include_re.findall(contents)
     return includes
 
index 2e1b6092a55a8eb8fb7b835e471d7e86290e3967..98ae2714ff50e5c5b092ef77cd7b52437280f728 100644 (file)
@@ -86,7 +86,7 @@ for var in old_SCons_Script_variables:
     except AttributeError:
         pass
     else:
     except AttributeError:
         pass
     else:
-        raise Exception, "unexpected variable SCons.Script.%s" % var
+        raise Exception("unexpected variable SCons.Script.%s" % var)
 """)
 
 test.write("m4.py", """\
 """)
 
 test.write("m4.py", """\
index 6401f7e7115a49067732314315a668e414ca2895..c49f62f4025edc63a4757e8978c8fe0f3752d4ba 100644 (file)
@@ -49,37 +49,37 @@ AllowSubstExceptions()
 
 try: env.subst('$NAME')
 except SCons.Errors.UserError, e: print e
 
 try: env.subst('$NAME')
 except SCons.Errors.UserError, e: print e
-else: raise Exception, "did not catch expected SCons.Errors.UserError"
+else: raise Exception("did not catch expected SCons.Errors.UserError")
 
 try: env.subst('${NAME}')
 except SCons.Errors.UserError, e: print e
 
 try: env.subst('${NAME}')
 except SCons.Errors.UserError, e: print e
-else: raise Exception, "did not catch expected SCons.Errors.UserError"
+else: raise Exception("did not catch expected SCons.Errors.UserError")
 
 try: env.subst('${INDEX[999]}')
 except SCons.Errors.UserError, e: print e
 
 try: env.subst('${INDEX[999]}')
 except SCons.Errors.UserError, e: print e
-else: raise Exception, "did not catch expected SCons.Errors.UserError"
+else: raise Exception("did not catch expected SCons.Errors.UserError")
 
 try: env.subst_list('$NAME')
 except SCons.Errors.UserError, e: print e
 
 try: env.subst_list('$NAME')
 except SCons.Errors.UserError, e: print e
-else: raise Exception, "did not catch expected SCons.Errors.UserError"
+else: raise Exception("did not catch expected SCons.Errors.UserError")
 
 try: env.subst_list('${NAME}')
 except SCons.Errors.UserError, e: print e
 
 try: env.subst_list('${NAME}')
 except SCons.Errors.UserError, e: print e
-else: raise Exception, "did not catch expected SCons.Errors.UserError"
+else: raise Exception("did not catch expected SCons.Errors.UserError")
 
 try: env.subst_list('${INDEX[999]}')
 except SCons.Errors.UserError, e: print e
 
 try: env.subst_list('${INDEX[999]}')
 except SCons.Errors.UserError, e: print e
-else: raise Exception, "did not catch expected SCons.Errors.UserError"
+else: raise Exception("did not catch expected SCons.Errors.UserError")
 
 
 
 try: env.subst('${1/0}')
 except SCons.Errors.UserError, e: print e
 
 
 
 try: env.subst('${1/0}')
 except SCons.Errors.UserError, e: print e
-else: raise Exception, "did not catch expected SCons.Errors.UserError"
+else: raise Exception("did not catch expected SCons.Errors.UserError")
 
 try: env.subst_list('${1/0}')
 except SCons.Errors.UserError, e: print e
 
 try: env.subst_list('${1/0}')
 except SCons.Errors.UserError, e: print e
-else: raise Exception, "did not catch expected SCons.Errors.UserError"
+else: raise Exception("did not catch expected SCons.Errors.UserError")
 
 AllowSubstExceptions(ZeroDivisionError)
 
 
 AllowSubstExceptions(ZeroDivisionError)
 
index 6a68c79a6031089a10f571cc77997620eebccb6e..79d869c4301c4a869f3cb21f078523940762486b 100644 (file)
@@ -36,7 +36,7 @@ SConstruct_path = test.workpath('SConstruct')
 
 test.write(SConstruct_path, """\
 def func(source = None, target = None, env = None):
 
 test.write(SConstruct_path, """\
 def func(source = None, target = None, env = None):
-    raise Exception, "func exception"
+    raise Exception("func exception")
 B = Builder(action = func)
 env = Environment(BUILDERS = { 'B' : B })
 env.B(target = 'foo.out', source = 'foo.in')
 B = Builder(action = func)
 env = Environment(BUILDERS = { 'B' : B })
 env.B(target = 'foo.out', source = 'foo.in')
@@ -44,7 +44,7 @@ env.B(target = 'foo.out', source = 'foo.in')
 
 test.write('foo.in', "foo.in\n")
 
 
 test.write('foo.in', "foo.in\n")
 
-expected_stderr = """scons: \*\*\* \[foo.out\] Exception : func exception
+expected_stderr = r"""scons: \*\*\* \[foo.out\] Exception : func exception
 Traceback \((most recent call|innermost) last\):
 (  File ".+", line \d+, in \S+
     [^\n]+
 Traceback \((most recent call|innermost) last\):
 (  File ".+", line \d+, in \S+
     [^\n]+
@@ -52,7 +52,7 @@ Traceback \((most recent call|innermost) last\):
 )*(  File ".+", line \d+, in \S+
     [^\n]+
 )*  File "%s", line 2, in func
 )*(  File ".+", line \d+, in \S+
     [^\n]+
 )*  File "%s", line 2, in func
-    raise Exception, "func exception"
+    raise Exception\("func exception"\)
 Exception: func exception
 """ % re.escape(SConstruct_path)
 
 Exception: func exception
 """ % re.escape(SConstruct_path)
 
index b29b39d06659ae08d595cefaf419e540119d8c91..fcc4c1bd760cf68f11404ffa07d2ab9620a40f0a 100644 (file)
@@ -34,7 +34,7 @@ test = TestSCons.TestSCons()
 
 test.write('SConstruct', """\
 def kfile_scan(node, env, target):
 
 test.write('SConstruct', """\
 def kfile_scan(node, env, target):
-    raise Exception, "kfile_scan error"
+    raise Exception("kfile_scan error")
 
 kscan = Scanner(name = 'kfile',
                 function = kfile_scan,
 
 kscan = Scanner(name = 'kfile',
                 function = kfile_scan,
@@ -57,7 +57,7 @@ test.run(arguments = "--debug=stacktrace",
 lines = [
     "scons: *** [foo] Exception : kfile_scan error",
     "scons: internal stack trace:",
 lines = [
     "scons: *** [foo] Exception : kfile_scan error",
     "scons: internal stack trace:",
-    'raise Exception, "kfile_scan error"',
+    'raise Exception("kfile_scan error")',
 ]
 
 test.must_contain_all_lines(test.stderr(), lines)
 ]
 
 test.must_contain_all_lines(test.stderr(), lines)
@@ -69,7 +69,7 @@ test.must_contain_all_lines(test.stderr(), lines)
 
 test.write('SConstruct', """\
 import SCons.Errors
 
 test.write('SConstruct', """\
 import SCons.Errors
-raise SCons.Errors.UserError, "explicit UserError!"
+raise SCons.Errors.UserError("explicit UserError!")
 """)
 
 test.run(arguments = '--debug=stacktrace',
 """)
 
 test.run(arguments = '--debug=stacktrace',