[Scons-users] Optional targets

syost at triad.rr.com syost at triad.rr.com
Mon Jan 15 15:15:27 EST 2018


Quick question:  Whats the best way to handle targets that may or may not get created?

I have a custom builder (with emitter) and a custom installer for a particular source file.   Basically, these build and install a couple of different locale specific files from each single source.

My problem is we don't support every locale for every different source.  In other words, we might generate a copy for both the en_US and fr_CA locales for one source, but only fr_CA for another source.   I cannot know ahead of time which ones get created (driven by the source file itself).  So I call the builder for the source and then use an emitter to enumerate every single possible outcome.  However, the installer forces the build to fail if one of the locales does not get created; even though its absence is "OK".

Clearly, ideally I would not try to install what does not exist, but since the custom installer is "pre-parsed" in SCons, any work around I come up - like "if os.path.isfile(localeFile)" - fails.  This is because no target never exists before the building starts and no dependencies are ever created and the builder never runs.

There has to be a quick trick for this.  Any ideas?



More information about the Scons-users mailing list