[Scons-users] Setting environment variables for scons to use globally on my system

Russel Winder russel at winder.org.uk
Thu May 15 06:01:16 EDT 2014


On Thu, 2014-05-15 at 04:31 -0500, Benjamin Lindley wrote:

> That will probably help, if I can figure out one more thing. This is

> more of a Python question though, so sorry if it's off topic (but maybe

> there's a scons specific answer). I guess I need to figure out how (if

> it's even possible) to change the default arguments to the Environment

> constructor. So, for example, if the SConstruct file has this:

>

> env = Environment()

>

> I want it to be as if it says this:

>

> env = Environment(tools = ['mingw'])

>

> Thanks for the help.


You are probably looking at having a "feature variable". I am not a fan
of command line options when working with SCons, so I tend to write in a
local.build.scons file (or some such)

local.build.scons:

tool_chooser = False

Then in the SConstruct:

tool_chooser = True

with open('local.build.scons') as f:
exec(f.read().strip())



if tool_chooser:
env = Environment(tools = ['mingw'])
else:
env = Environment()

then the SConstruct is programmed with the options and a default, and
the local file contains the selector that needs to be edited.

It's not a great solution, but it works.

--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder at ekiga.net
41 Buckmaster Road m: +44 7770 465 077 xmpp: russel at winder.org.uk
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder



More information about the Scons-users mailing list