[Scons-users] Optional targets

Bobby Casey beecee808 at gmail.com
Mon Jan 15 15:38:39 EST 2018

Would it be possible for you to create a script (or Python function) that
parses the file to determine which files should be generated and call that
from the emitter? It's not a great solution but may be enough to get you by.

On Mon, Jan 15, 2018, 3:15 PM <syost at triad.rr.com> wrote:

> 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?
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180115/1feaa0f0/attachment.html>

More information about the Scons-users mailing list