[Scons-users] exporting environment to SConscript
    Evan Driscoll 
    driscoll at cs.wisc.edu
       
    Wed Jun 20 23:43:09 EDT 2012
    
    
  
On Wednesday, June 20, 2012 08:25:35 PM Eric Smith wrote:
> I use Sconscript like this:
> 
>     SConscript (dirs = ['src'],
>                 variant_dir = 'build-32',
>                 duplicate = 0,
>                 exports = ['env'])
> 
> Is there some way to export a specific env such as env_linux_32_debug,
> but such that it winds up just being 'env' in a particular invocation of
> the SConscript, then later export a different env such as
> env_windows_64_release into a different invocation?
The 'exports' keyword argument can be a dictionary; I think something like
   SConscript(...., exports = {'env': 'env_linux_32_debug' })
should work for you.
Here's an example:
    $ cat SConstruct
    # Use strings to simplify things
    env1 = "env1"
    env2 = "env2"
    for the_env in [env1, env2]:
        SConscript("SConscript", exports={'env': the_env})
    $ cat SConscript
    Import("env")
    print "SConscript received", env
    $ scons --quiet
    SConscript received env1
    SConscript received env2
This is one of those important pieces of information that, IIRC, is completely 
missing from the user's guide and seems like it really ought to be there. (One 
of the deficiencies of the SCons documentation is there's a few things like 
that, where the user's guide is missing something fairly important that you 
can do. So you kind of need to read the manpage too, as massive as it is, to 
even learn "this is possible".)
Evan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20120620/a7363bcf/attachment.html>
    
    
More information about the Scons-users
mailing list