You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ninja tool sometimes obscures getting file contents for scanning #4581
It is reported that sometimes dependencies are not found when generating the build.ninja file. This appears to happen because the tool monkey-patches several core SCons routines as not needed, so the ninja work can go faster. One of those has a side effect that may not be what we want:
Means for a File node, we get a decorated form of get_contents. The decorator is:
defninja_contents(original):
"""Return a dummy content without doing IO"""defwrapper(self):
ifisinstance(self, SCons.Node.Node) and (self.is_sconscript() orself.is_conftest()):
returnoriginal(self)
returnbytes("dummy_ninja_contents", encoding="utf-8")
returnwrapper
So only if the node is an SConscript file, or we're a conftest node will the file's contents be returned, else it's skipped. That's fine - we don't need the binary file contents in ninja mode, but we do need the text contents, for use by the scanner, if the file type has a scanner. There is no consistency about how this is done across all the Node types, but in the case of File nodes, get_text_contents is implemented in terms of get_contents:
defget_text_contents(self) ->str:
"""Return the contents of the file as text."""returnSCons.Util.to_Text(self.get_contents())
Since the matching get_contents is stubbed out in this case, we don't get any file contents. Most scanners use get_text_contents, so perhaps some rethinking is needed here.
Activity