Skip to content

BuildInfoCollector.py does not gather any information and fails #44

@alexander-titov

Description

@alexander-titov

Hi,

Adding BuildInfoCollector.py to my scons command line leads to a failure.

>/bin/scons/2.5.0/bin/scons -f SConstruct -f BuildInfoCollector.py
scons: Reading SConscript files ...
USER_INCLUDES = []
TypeError: 'NoneType' object is not subscriptable:
  File "/users/atitov/repos/master/BuildInfoCollector.py", line 226:
    write_build_infos(includes, macros, env)
  File "/users/atitov/repos/master/BuildInfoCollector.py", line 186:
    print 'SYS_C_INCLUDES = [%s]' % to_string(collect_sys_includes('cc', environ), environ)
  File "/users/atitov/repos/master/BuildInfoCollector.py", line 91:
    cc_output = invoke_compiler(lang, environ)
  File "/users/atitov/repos/master/BuildInfoCollector.py", line 76:
    [get_compiler(environ), '-v', get_gcc_lang_param(lang)] + get_compiler_flags(lang, environ) + [in_path, '-o', out_path],
  File "/users/atitov/repos/master/BuildInfoCollector.py", line 113:
    if environ['PLATFORM'] == 'win32' and environ['CXX'] == 'g++':

Without BuildInfoCollector.py everything works well.

As I understand the problem is in the method collect_build_infos
(prints were added by me):

def collect_build_infos(super_nodes):
    print('super_nodes', type(super_nodes), super_nodes)
    def no_scan_fun(node, _):
        return node.children(scan=0)

    children_fun = (no_scan_fun if has_build_targets() else SCons.Node.get_children)
    includes, macros = set(), set()
    compiler_env = None

    for snode in super_nodes:
        print ('snode', type(snode), snode)
        walker = SCons.Node.Walker(snode, kids_func=children_fun)
        node = walker.get_next()
        print ('node', type(node), node)
        while node:
            print ('has builder?', node.has_builder())
            if node.has_builder():
                environ = node.get_build_env()

                if 'CPPPATH' in environ:
                    includes.update(collect_user_includes(environ))
                if 'CPPDEFINES' in environ:
                    macros.update(collect_macros_from_cpp_defines(environ))
                if 'CCFLAGS' in environ:
                    macros.update(collect_macros_from_cc_flags(environ))
                if not compiler_env and ('CC' in environ or 'CXX' in environ):
                    compiler_env = environ
            node = walker.get_next()

    return (includes, macros, compiler_env)

The output of my prints:

('super_nodes', <type 'list'>, [<SCons.Node.Alias.Alias object at 0xf8f640>])
('snode', <class 'SCons.Node.Alias.Alias'>, <SCons.Node.Alias.Alias object at 0xf8f640>)
('node', <class 'SCons.Node.Alias.Alias'>, <SCons.Node.Alias.Alias object at 0xf8f640>)
('has builder?', False)

I do not familiar with SCons too much, so I do not know what exactly is going on here.
As I understand, the nodes were not parsed correctly.

Can you please look at this issue?

Regards,
Alexander

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions