Scons 自定义依赖扫描器构造函数 returns NONE 对象

Scons custom dependency scanner constructor returns NONE object

以下代码片段属于 Sconscript 文件。

...

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)
...

但事实证明 dscanner 对象是 None。所以请提出为什么会这样。我试图从文档中弄清楚这一点,但做不到。

Mats 在下面说了什么。

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.