Re: Attaching an emitter to an existing builder

Mats Wichmann <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <[email protected]>
On 1/27/21 3:11 PM, Bill Deegan wrote:
> Jeremy,
> 
> Greetings!
> You're not the first to mention adding the map file as a side effect. 
> (or target)
> Please go ahead and file and Issue on github for this.
> Ideally with a simple example, what the gcc flag is, and what the file 
> naming/location would be?
> 
> So likely the easiest way to add an emitter to Program() would be the 
> following (not tested)
> 
> env.Append(PROGEMITTER = [my_map_emitter])
> 
> Give that a try and let us know if it works for you?
> 
> Also there's a discord server for scons help if you'd like to ask 
> questions/get help there.
> https://discord.gg/bXVpWAy <https://discord.gg/bXVpWAy>
> 
> Hope that helps!
> -Bill

For inspiration, the mslink tool does this (as does the qt tool) - see 
the somewhat messy SCons/Tool/mslink.py.

Meanwhile, while many tools use add_emitter, the code for add_emitter 
itself includes this comment:

         This assumes that emitter has been initialized with an
         appropriate dictionary type, and will throw a TypeError if
         not, so the caller is responsible for knowing that this is an
         appropriate method to call for the Builder in question.

>              env["BUILDERS"]["Program"].add_emitter(
>                  suffix = ".map",
>                  emitter = map_emitter)
> 
>     But it throws an exception:
> 
>     TypeError: 'EmitterProxy' object does not support item assignment

So I guess "expected"? although pretty awkward....

_______________________________________________
Scons-users mailing list
[email protected]
https://pairlist4.pair.net/mailman/listinfo/scons-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.