diff options
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/SCons/Node/FS.py | 10 | ||||
| -rw-r--r-- | src/engine/SCons/Node/FSTests.py | 8 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/engine/SCons/Node/FS.py b/src/engine/SCons/Node/FS.py index ece238a..06778a5 100644 --- a/src/engine/SCons/Node/FS.py +++ b/src/engine/SCons/Node/FS.py @@ -870,6 +870,16 @@ class File(Entry): try: path = target.scanner_paths[scanner] + except AttributeError: + # The target had no scanner_paths attribute, which means + # it's an Alias or some other node that's not actually a + # file. In that case, back off and use the path for this + # node itself. + try: + path = self.scanner_paths[scanner] + except KeyError: + path = scanner.path(env, self.cwd) + self.scanner_paths[scanner] = path except KeyError: path = scanner.path(env, target.cwd) target.scanner_paths[scanner] = path diff --git a/src/engine/SCons/Node/FSTests.py b/src/engine/SCons/Node/FSTests.py index 6ca8182..a78e5ee 100644 --- a/src/engine/SCons/Node/FSTests.py +++ b/src/engine/SCons/Node/FSTests.py @@ -754,6 +754,14 @@ class FSTestCase(unittest.TestCase): assert deps == [xyz], deps assert s.call_count == 2, s.call_count + # 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: + pass + + deps = f12.get_found_includes(env, s, DummyNode()) + assert deps == [xyz], deps + # Test building a file whose directory is not there yet... f1 = fs.File(test.workpath("foo/bar/baz/ack")) assert not f1.dir.exists() |
