[Scons-users] 2.5.0 scanner fidelity regression since 2.3.4

Dave Vitek dvitek at grammatech.com
Thu Mar 16 15:25:45 EDT 2017


Hi all,

I'll just start off with a self-contained test case to describe the problem:

# SConstruct
Command('test2.h', 'test.h', 'echo "" > test2.h')
Library('test.c')

// test.c
#include "test.h"
#include "test2.h"

// test.h
#include "test2.h"


With 2.3.4, this ran successfully.

With 2.5.0 we have this:
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: done building targets.

scons: *** Found dependency cycle(s):
   test2.h -> test2.h


The problem is that it is trying to use the C preprocessor scanner to do 
scanning on behalf of the Command builder, which is not desirable since 
echo does not run the CPP.

It looks like this is happening because in the old version, scons would 
not run scanners on nodes without scanners due to this line inside the 
scan method inside Executor.py:
                 scanner = node.get_env_scanner(env, kw)
                 if not scanner:
                     continue

In the new Executor.py, this logic is gone, so various scanner-related 
stuff gets activated regardless.

One thought that crossed my mind was to set scanner to None inside 
Node/__init__.py here:
     def _get_scanner(self, env, initial_scanner, root_node_scanner, kw):
         if not initial_scanner:
             # handle implicit scanner case
             scanner = self.get_env_scanner(env, kw)
             if scanner:
                 scanner = scanner.select(self)

instead of getting a scanner based on the file extension.

Thoughts?

- Dave


More information about the Scons-users mailing list