This comes down to one of the core design ideas of SCons. A scons script
should be able to run on any system regardless of the environmental state of
that system. For this reason scons starts up a subshell and discards ALL
environment variables. This can be annoying since it can cause scons to not
find things that are specified in the PATH environment variable.
In general you should specify the build option on the command line. There are
ways to work around this but it requires a developer taking the time to specify
in the scons script which environment variables are not going to get discarded.
It must be done for each and every environment variable and it should also
default to the command line value if it is specified.
To do this you would have to add something like this to the SConscript
If os.environ.has_key(?ANDROID_GRADLE?):
android_gradle = os.path.normpath(os.environ[?ANDROID_GRADLE?])
# place android_gradle where it would need to be placed for the rest of the
SConscript to operate
# typically the same location as it is placed when it comes in from the
command line but only if that
# variable is not already filled in by the command line.
# you would then have to push the change back up stream to get it into the
project.
George
From: iotivity-dev-bounces at lists.iotivity.org
[mailto:[email protected]] On Behalf Of Gregg Reynolds
Sent: Tuesday, May 31, 2016 8:44 AM
To: iotivity-dev at lists.iotivity.org
Subject: [dev] scons help: env vars
Ok, I've banged my head on this for about an hour now and I surrender. How can
I get the value of and env var like ANDROID_GRADLE into a SConscript?
In particular, I have exported
ANDROID_GRADLE=extlibs/android/gradle/gradle-2.2.1/bin/gradle but when I run
either scons or auto_build, it does not propagate to e.g.
env.get('ANDROID_GRADLE')
It does if I add it to the command line, however. I imagine this has something
to do with subshells or the like but it seems like we should be able to set
such env vars and have them used.
Thanks,
Gregg
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.iotivity.org/pipermail/iotivity-dev/attachments/20160531/a5184ee0/attachment.html>