Search code examples
pythonscons

Scons custom dependency scanner constructor returns NONE object


Following code snippet belongs to a Sconscript file.

...

def dependency_add(node, env, path):
    print("scanner invoked.")
    return [env.File('src/sanitizer_blacklist.txt')]

dscanner = Scanner(function = dependency_add, skeys=['.c'])

print(dscanner)
...

But it turns out that dscanner object is None. So please suggest why that might be the case. I tried to figure this out from docs but could not.


Solution

  • What Mats said below.

    It's an oddity of the SCons API, not a bug. The default name attribute of a scanner object is "NONE", and that's what str of the object returns. If you supply the name when constructing the object you should get something a little more descriptive.