SCons / scons

SCons - a software construction tool
http://scons.org
MIT License
2.05k stars 312 forks source link

Variables.Save allow forcing save of a default value #2827

Open bdbaddog opened 6 years ago

bdbaddog commented 6 years ago

This issue was originally created at: 2012-03-23 00:47:59. This issue was reported by: mortoray.

mortoray said at 2012-03-23 00:47:59

Looking at the code for Variables I see that variables are not saved if they match their default value. A way to force the saving of all variables, or selectively, would be quite beneficial.

The issue is that when the user first runs scons it will be with several variables. Some of the defaults may come from the environment (via os.environ). The next time they run scons these defaults may not actually be the same, but it is not intended to use this new value. The value which existed at the original configure time should be fixed and used forever.

I think it might be easiest to just save all the variables (boolean flag?). If the user's environment does change, they can always reconfigure.

I don't have an easy workaround at the moment.

mwichmann commented 4 months ago

One incremental improvement might be to do what has been attempted for options - try to distinguish "value is the default because nothing was specified for this variable" vs. "variable was specified with a value which is equal to the default", and have the latter case be stored by Save().