[Scons-users] How to import the env through which was env.SConscript( called

Zarko Berberski (Aditi Staffing LLC) v-zaberb at microsoft.com
Tue Jun 13 14:27:27 EDT 2017


OK found the correct path (https://bitbucket.org/dirkbaechle/scons_talks/src/82c1f521676ab61f0d436bb1f8e659f5c377cbb3/pyconde_2013/examples/exvar/?at=default)
but it doesn't work for me (scons-2.5.0) when I use deliberately different name:

env_LKG = env.Clone()
    no_prior, top_LKG = env_LKG.SConscript('ocaml-LKG/ocaml-output.scons', export={'My_env' : env_LKG})
. . . .
Import('My_env')


ð  UseError: Import of non-existent variable ''My_env''

If I use export={'env' : env_LKG} / Import('env')

Then it happily imports the main env - from which env_LKG was cloned


From: Scons-users [mailto:scons-users-bounces at scons.org] On Behalf Of Dirk Bächle
Sent: Tuesday, June 13, 2017 03:30
To: scons-users at scons.org
Subject: Re: [Scons-users] How to import the env through which was env.SConscript( called


Hi Zarko,

On 13.06.2017 06:02, Zarko Berberski (Aditi Staffing LLC) via Scons-users wrote:
I do a clone and call Sconcript with that clone, but that connection seems to be lost
>             SConsEnvironment.SConscript in SConscript line 541        --- still has self (which is env)
               _SConscript in SConscript line 250                                         --- env connection lost

I can't import by name since identical scripts needs to build in 2 folders (which may become -  variant_dir) => they shouldn't know which env to import - they should work with the one that's given to them.


please check out the example

  https://bitbucket.org/dirkbaechle/scons_talks/src/pyconde_2013/examples/exvar<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbitbucket.org%2Fdirkbaechle%2Fscons_talks%2Fsrc%2Fpyconde_2013%2Fexamples%2Fexvar&data=02%7C01%7Cv-zaberb%40microsoft.com%7C9ee3375f30aa4580d6ad08d4b247eca9%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636329469370820209&sdata=%2F1G9zhoziEVSFlkXk6xGzzcoRBJspIhFWNpP7Fs0WyU%3D&reserved=0>

from the main "SCons talks" repo https://bitbucket.org/dirkbaechle/scons_talks<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbitbucket.org%2Fdirkbaechle%2Fscons_talks&data=02%7C01%7Cv-zaberb%40microsoft.com%7C9ee3375f30aa4580d6ad08d4b247eca9%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636329469370820209&sdata=ShKEDLLOVlTh5HEuhiK%2FZ3mYnCKSWnyr76gh6vn%2FBuo%3D&reserved=0> . It shows how to use the "export" keyword for SConscript, which is the canonical way of doing what you're trying to accomplish.

Best regards,

Dirk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20170613/fffe29f4/attachment.html>


More information about the Scons-users mailing list