[Scons-users] How to correctly use emitters

Pierre-Luc Boily pierreluc.boily at gmail.com
Tue Oct 25 11:29:04 EDT 2016


Hello,

I am having trouble understand emitters.

I have this emitter  here <http://pastebin.com/Y7H6LPe0>  being call from a
builder in my sconscript  here <http://pastebin.com/M3JT3Rga>  .  As you can
see, I use the target and append to it new targets.  This lead to a weird
behavior.  If you check my tree  here <http://pastebin.com/vnZBMHx6>  ,
there is a target call /command/, but this target does not exist!  It looks
like coming from a file name from source that I specified in sconscript,
/commands.grammar/

If I changed the emitter to have something like this instead :
/def _emit_build_grammar(target, source, env):
    files = [
      env['ENV']['LOCALROOT'] + '/sr/sra/src/grammars/' +
env['ENV']['LANGUAGE'] + '/' + env['ENV']['GRAMMAR_NAME'] + '/faa.autopron',
      env['ENV']['LOCALROOT'] + '/sr/sra/src/grammars/' +
env['ENV']['LANGUAGE'] + '/' + env['ENV']['GRAMMAR_NAME'] + '/faa.missing',
      env['ENV']['LOCALROOT'] + '/sr/sra/src/grammars/' +
env['ENV']['LANGUAGE'] + '/' + env['ENV']['GRAMMAR_NAME'] +
'/faa.functions']
    return files, source/

 then, my tree looks better <http://pastebin.com/U2iTtWXf>  ! (Still have a
/command /folder, but not as target anymore)

So, question :
1 - When, for my emitter,  should I append to target new targets and when
should I override?
2 - Why when I append, I have this weird behavior where I have a target
named /command/?
3 - I have a lot of binaries files generated by this builder and lot of
files copied.  Should I use emitter or Clean to get them removed?
4 - And actually, when should I use emitter vs Clean?  in my example above,
those file are generated by a perl script.  I feel that have them removed by
Clean should be good enough.

Thank you for your patience!

Pierre-Luc



--
View this message in context: http://scons.1086193.n5.nabble.com/How-to-correctly-use-emitters-tp40675.html
Sent from the Users mailing list archive at Nabble.com.


More information about the Scons-users mailing list