summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2010-05-12 13:28:14 (GMT)
committerSteven Knight <knight@baldmt.com>2010-05-12 13:28:14 (GMT)
commit2d3dac462fc5fb32e8132617a760478de070981e (patch)
treea8a14daa28652e93619e69d5ffe01b2b7a9f0b2b /src/engine/SCons
parent53fc08f1c8d9d4d0174247cb34b770342fd25068 (diff)
downloadSCons-2d3dac462fc5fb32e8132617a760478de070981e.zip
SCons-2d3dac462fc5fb32e8132617a760478de070981e.tar.gz
SCons-2d3dac462fc5fb32e8132617a760478de070981e.tar.bz2
Convert old-style classes to new-style classes.
Leave the Proxy class in Node/FSTests.py, which can't be converted until we convert Node/FS.py itself. Update the AttributeError matches to search for the new "'Foo' object..." error message in addition to the old "'Foo' instance..." message.
Diffstat (limited to 'src/engine/SCons')
-rw-r--r--src/engine/SCons/Node/FSTests.py20
-rw-r--r--src/engine/SCons/SubstTests.py22
2 files changed, 22 insertions, 20 deletions
diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py
index 38a895b..e013136 100644
--- a/src/engine/SCons/Node/FSTests.py
+++ b/src/engine/SCons/Node/FSTests.py
@@ -44,7 +44,7 @@ built_it = None
scanner_count = 0
-class Scanner:
+class Scanner(object):
def __init__(self, node=None):
global scanner_count
scanner_count = scanner_count + 1
@@ -61,7 +61,7 @@ class Scanner:
def recurse_nodes(self, nodes):
return nodes
-class Environment:
+class Environment(object):
def __init__(self):
self.scanner = Scanner()
def Dictionary(self, *args):
@@ -75,7 +75,7 @@ class Environment:
def _update(self, dict):
pass
-class Action:
+class Action(object):
def __call__(self, targets, sources, env, **kw):
global built_it
if kw.get('execute', 1):
@@ -92,7 +92,7 @@ class Action:
def get_implicit_deps(self, target, source, env):
return []
-class Builder:
+class Builder(object):
def __init__(self, factory, action=Action()):
self.factory = factory
self.env = Environment()
@@ -429,7 +429,7 @@ class VariantDirTestCase(unittest.TestCase):
assert r == d1, "%s != %s" % (r, d1)
# verify the link creation attempts in file_link()
- class LinkSimulator :
+ class LinkSimulator (object):
"""A class to intercept os.[sym]link() calls and track them."""
def __init__( self, duplicate, link, symlink, copy ) :
@@ -1147,7 +1147,7 @@ class FSTestCase(_tempdirTestCase):
# Make sure we can scan this file even if the target isn't
# a file that has a scanner (it might be an Alias, e.g.).
- class DummyNode:
+ class DummyNode(object):
pass
deps = f12.get_found_includes(env, s, DummyNode())
@@ -2081,10 +2081,10 @@ class EntryTestCase(_tempdirTestCase):
assert e4n.__class__ is SCons.Node.FS.File, e4n.__class__
assert not exists, "e4n exists?"
- class MyCalc:
+ class MyCalc(object):
def __init__(self, val):
self.max_drift = 0
- class M:
+ class M(object):
def __init__(self, val):
self.val = val
def collect(self, args):
@@ -2952,8 +2952,8 @@ class stored_infoTestCase(unittest.TestCase):
bi = f.get_stored_info()
assert hasattr(bi, 'ninfo')
- class MySConsign:
- class Null:
+ class MySConsign(object):
+ class Null(object):
def __init__(self):
self.xyzzy = 7
def get_entry(self, name):
diff --git a/src/engine/SCons/SubstTests.py b/src/engine/SCons/SubstTests.py
index 1c8412c..e1cd833 100644
--- a/src/engine/SCons/SubstTests.py
+++ b/src/engine/SCons/SubstTests.py
@@ -35,7 +35,7 @@ import SCons.Errors
from SCons.Subst import *
-class DummyNode:
+class DummyNode(object):
"""Simple node work-alike."""
def __init__(self, name):
self.name = os.path.normpath(name)
@@ -48,7 +48,7 @@ class DummyNode:
def get_subst_proxy(self):
return self
-class DummyEnv:
+class DummyEnv(object):
def __init__(self, dict={}):
self.dict = dict
@@ -83,7 +83,7 @@ def CmdGen1(target, source, env, for_signature):
assert str(source) == 's', source
return "${CMDGEN2('foo', %d)}" % for_signature
-class CmdGen2:
+class CmdGen2(object):
def __init__(self, mystr, forsig):
self.mystr = mystr
self.expect_for_signature = forsig
@@ -106,7 +106,7 @@ class SubstTestCase(unittest.TestCase):
"""Simple node work-alike with some extra stuff for testing."""
def __init__(self, name):
DummyNode.__init__(self, name)
- class Attribute:
+ class Attribute(object):
pass
self.attribute = Attribute()
self.attribute.attr1 = 'attr$1-' + os.path.basename(name)
@@ -115,7 +115,7 @@ class SubstTestCase(unittest.TestCase):
return self.name + extra
foo = 1
- class TestLiteral:
+ class TestLiteral(object):
def __init__(self, literal):
self.literal = literal
def __str__(self):
@@ -123,7 +123,7 @@ class SubstTestCase(unittest.TestCase):
def is_literal(self):
return 1
- class TestCallable:
+ class TestCallable(object):
def __init__(self, value):
self.value = value
def __call__(self):
@@ -511,7 +511,7 @@ class scons_subst_TestCase(SubstTestCase):
"""Test scons_subst(): handling attribute errors"""
env = DummyEnv(self.loc)
try:
- class Foo:
+ class Foo(object):
pass
scons_subst('${foo.bar}', env, gvars={'foo':Foo()})
except SCons.Errors.UserError, e:
@@ -519,6 +519,7 @@ class scons_subst_TestCase(SubstTestCase):
"AttributeError `bar' trying to evaluate `${foo.bar}'",
"AttributeError `Foo instance has no attribute 'bar'' trying to evaluate `${foo.bar}'",
"AttributeError `'Foo' instance has no attribute 'bar'' trying to evaluate `${foo.bar}'",
+ "AttributeError `'Foo' object has no attribute 'bar'' trying to evaluate `${foo.bar}'",
]
assert str(e) in expect, e
else:
@@ -961,7 +962,7 @@ class scons_subst_list_TestCase(SubstTestCase):
"""Test scons_subst_list(): handling attribute errors"""
env = DummyEnv()
try:
- class Foo:
+ class Foo(object):
pass
scons_subst_list('${foo.bar}', env, gvars={'foo':Foo()})
except SCons.Errors.UserError, e:
@@ -969,6 +970,7 @@ class scons_subst_list_TestCase(SubstTestCase):
"AttributeError `bar' trying to evaluate `${foo.bar}'",
"AttributeError `Foo instance has no attribute 'bar'' trying to evaluate `${foo.bar}'",
"AttributeError `'Foo' instance has no attribute 'bar'' trying to evaluate `${foo.bar}'",
+ "AttributeError `'Foo' object has no attribute 'bar'' trying to evaluate `${foo.bar}'",
]
assert str(e) in expect, e
else:
@@ -1105,7 +1107,7 @@ class quote_spaces_TestCase(unittest.TestCase):
q = quote_spaces('x\tx')
assert q == '"x\tx"', q
- class Node:
+ class Node(object):
def __init__(self, name, children=[]):
self.children = children
self.name = name
@@ -1182,7 +1184,7 @@ class subst_dict_TestCase(unittest.TestCase):
assert SOURCES == ['s1', 's2'], d['SOURCES']
assert str(d['SOURCE']) == 's1', d['SOURCE']
- class V:
+ class V(object):
# Fake Value node with no rfile() method.
def __init__(self, name):
self.name = name