From 31d33033b32826914dd32fde0e52a7edf8d8720b Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Sun, 16 May 2010 14:44:28 +0000 Subject: Commit old-style classes in Node/__init__.py to new-style classes. Fix a ripple-effect in Script/Main.py by using obj.__class__.__name_ to, uh, fetch the name of a class. --- src/engine/SCons/Node/__init__.py | 10 +++++----- src/engine/SCons/Script/Main.py | 8 +++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/engine/SCons/Node/__init__.py b/src/engine/SCons/Node/__init__.py index 7847a9b..79ba730 100644 --- a/src/engine/SCons/Node/__init__.py +++ b/src/engine/SCons/Node/__init__.py @@ -97,7 +97,7 @@ Annotate = do_nothing # Classes for signature info for Nodes. -class NodeInfoBase: +class NodeInfoBase(object): """ The generic base class for signature information for a Node. @@ -147,7 +147,7 @@ class NodeInfoBase: fields.append(f) return fields -class BuildInfoBase: +class BuildInfoBase(object): """ The generic base class for build information for a Node. @@ -169,7 +169,7 @@ class BuildInfoBase: def merge(self, other): self.__dict__.update(other.__dict__) -class Node: +class Node(object): """The base Node class, for entities that we know how to build, or use to build other Nodes. """ @@ -179,7 +179,7 @@ class Node: memoizer_counters = [] - class Attrs: + class Attrs(object): pass def __init__(self): @@ -1260,7 +1260,7 @@ def get_children(node, parent): return node.children() def ignore_cycle(node, stack): pass def do_nothing(node, parent): pass -class Walker: +class Walker(object): """An iterator for walking a Node tree. This is depth-first, children are visited before the parent. diff --git a/src/engine/SCons/Script/Main.py b/src/engine/SCons/Script/Main.py index a1df683..d5057e1 100644 --- a/src/engine/SCons/Script/Main.py +++ b/src/engine/SCons/Script/Main.py @@ -207,12 +207,10 @@ class BuildTask(SCons.Taskmaster.OutOfDateTask): t = self.targets[0] if self.top and not t.has_builder() and not t.side_effect: if not t.exists(): - def classname(obj): - return str(obj.__class__).split('.')[-1] - if classname(t) in ('File', 'Dir', 'Entry'): - errstr="Do not know how to make %s target `%s' (%s)." % (classname(t), t, t.abspath) + if t.__class__.__name__ in ('File', 'Dir', 'Entry'): + errstr="Do not know how to make %s target `%s' (%s)." % (t.__class__.__name__, t, t.abspath) else: # Alias or Python or ... - errstr="Do not know how to make %s target `%s'." % (classname(t), t) + errstr="Do not know how to make %s target `%s'." % (t.__class__.__name__, t) sys.stderr.write("scons: *** " + errstr) if not self.options.keep_going: sys.stderr.write(" Stop.") -- cgit v0.12