I'm using scons 2.5.1. I want to create a builder with an emitter that changes the target name, e.g.:
def modify_targets(target, source, env):
target[0] = 'new_target'
return target, source
bld = Builder(action = 'echo $TARGETS - $SOURCES',
suffix = ".out",
src_suffix = '.input',
emitter = modify_targets)
env = Environment(BUILDERS = {'Foo' : bld})
env.Foo('file')
The dependency tree then looks like this:
$ scons -Q --tree=all,status
echo new_target - file.input
new_target - file.input
E = exists
R = exists in repository only
b = implicit builder
B = explicit builder
S = side effect
P = precious
A = always build
C = current
N = no clean
H = no cache
[E b ]+-.
[E C ] +-SConstruct
[E C ] +-file.input
[ ] +-file.out
[ B ] +-new_target
[E C ] +-file.input
[E C ] +-/bin/echo
There is this implicit file.out
which should be removed by the emitter. This is causing problems in a case when I need to create a dependency on a directory (e.g. the directory is a source). Scons then complains about Implicit dependency 'somedir/file.out' not found, needed by target 'xyz'
. This file will never exist. How can I force the Builder not to create the implicit dependency?
Update: it seems that the Builder first creates a SCons.Node.FS.Entry
which then remains somewhere in the cache even if it is removed from targets list by the emitter.