[Scons-dev] Why are Builders excluded from env.Clone()?

Jonathon Reinhart jonathon.reinhart at gmail.com
Fri Dec 9 13:27:40 EST 2016


Hi Bill,

On Fri, Dec 9, 2016 at 12:46 PM, Bill Deegan <bill at baddogconsulting.com> wrote:
> Is your real issue (which caused you to dig into this)
> "The big problem here is that c_file, cxx_file are *not* unique to the
> passed-in
> environment."
>
> Perhaps a solution to just that piece of the puzzle would be simpler?

Mostly so, yes. In my experience, this applies to both of these functions:

   SCons.Tool.createCFileBuilders(env)
   SCons.Tool.createObjBuilders(env)

..but it could easily apply to anything from Tool/__init__.py, where
builders are added to an environment if they don't already exist.

A naive solution to this particular piece of the puzzle might be to
*always* create a new builder, apply it to the environment, and return
it. But this doesn't work, because many tools simply want to add
another way (suffix) to build the same type of thing (Builder). If the
tool always caused a new builder to be generated, all of the suffixes
for other tools would be lost.

As I reason through this, the fact that builders aren't cloned really
seems to be the central problem.


More information about the Scons-dev mailing list