- Use the source_scanner from the target Node, not the source node
itself.
- - Enforce internally that Scanners are only passed Nodes. Fix how a
- Scanner.Selector called its base class initialization.
+ - Internal Scanners fixes: Make sure Scanners are only passed Nodes.
+ Fix how a Scanner.Selector called its base class initialization.
+ Make comparisons of Scanner objects more robust.
From Christoph Wiedemann:
assert tgt.target_scanner == tscan, tgt.target_scanner
assert tgt.source_scanner == tscan, tgt.source_scanner
+ def test_actual_scanner(self):
+ """Test usage of actual Scanner objects."""
+
+ import SCons.Scanner
+
+ def func(self):
+ pass
+
+ scanner = SCons.Scanner.Scanner(func, name='fooscan')
+
+ b1 = SCons.Builder.Builder(action='bld', target_scanner=scanner)
+ b2 = SCons.Builder.Builder(action='bld', target_scanner=scanner)
+ b3 = SCons.Builder.Builder(action='bld')
+
+ assert b1 == b2
+ assert b1 != b3
+
def test_src_scanner(slf):
"""Testing ability to set a source file scanner through a builder."""
class TestScanner:
env.VARIABLE = "i4"
self.test(s, env, DummyNode('i4.cpp'), ['i4.h', 'i4.hpp'], arg)
+ def test___cmp__(self):
+ """Test the Scanner.Base class __cmp__() method"""
+ s = SCons.Scanner.Base(self.func, "Cmp")
+ assert cmp(s, None)
+
def test_hash(self):
"""Test the Scanner.Base class __hash__() method"""
s = SCons.Scanner.Base(self.func, "Hash")
return nodes
def __cmp__(self, other):
- return cmp(self.__dict__, other.__dict__)
+ try:
+ return cmp(self.__dict__, other.__dict__)
+ except AttributeError:
+ # other probably doesn't have a __dict__
+ return cmp(self.__dict__, other)
def __hash__(self):
return id(self)