[Scons-users] Edit the environment variables in custom.py

Mats Wichmann mats at wichmann.us
Sat Aug 1 09:34:32 EDT 2020


On 7/31/20 8:55 PM, asvvvad at disroot.org wrote:
> Hello,
> I'm trying to edit the environment for a build from within the custom.py config file. Is it still available?

There's nothing magical about the name "custom.py". That filename
happens to be used in some examples, particularly as an argument to
Variables(), but the file (or files) to pass to that function can be any
name.

If this is what you meant (Variables)...

> The only answers I found while searching were 7 years old (both Github Wiki and StackOverflow) and
> they suggest using Evironment() but it gives me a "NameError: name 'Environment' is not defined" error i tried importing "Evironment" and "evironment" but with no luck.
> Is there a way to do that?

You don't need to mess with Environment to set this way.  Just do

Variables(files='default.py')

and anything that looks like a variable setting in 'default.py' will be
imported into the DefaultEnvironment (and if you create one, into
Environment) as construction variables.


More information about the Scons-users mailing list