Allow setting of individual config settings via -s flags#12608
Allow setting of individual config settings via -s flags#12608
-s flags#12608Conversation
This means that the config setting `COMPILER_WRAPPER` can also be set on the command line via `-s COMPILER_WRAPPER='foo'`. Caveat: Using this feature ends up overriding he config setting fairly late in the process which is too late for certain settings to be overridden (for example -sLLVM_ROOT won't work because its value is module used during startup when shared.py is first imported. I'm have some factors planning to make this less of a problem). Fixes: #12340
e4ddca8 to
67526d9
Compare
|
After this change, what is the precedence order of settings? Config < Environment Variable < Commandline? |
|
Yup. |
|
I'm not sure if this is in the scope of this PR, but would it be possible to include a switch to ignore environment variables altogether? |
|
That sounds unrelated to this PR yes. Maybe open an issue for that? We can discuss further there. |
kripken
left a comment
There was a problem hiding this comment.
The caveat here worries me.
Perhaps we could do a refactoring before this PR to avoid capturing these variables anywhere, so that when we use them, at least, we always look at the latest value?
|
|
||
| if 'EMMAKEN_COMPILER' in os.environ: | ||
| diagnostics.warning('deprecated', '`EMMAKEN_COMPILER` is deprecated.\n' | ||
| 'To use an alteranative LLVM build set `LLVM_ROOT` in the config file (or `EM_LLVM_ROOT` env var).\n' |
There was a problem hiding this comment.
| 'To use an alteranative LLVM build set `LLVM_ROOT` in the config file (or `EM_LLVM_ROOT` env var).\n' | |
| 'To use an alternative LLVM build, set `LLVM_ROOT` in the config file (or `EM_LLVM_ROOT` env var).\n' |
|
I do have plans, and have tried a few times in the past to change the way startup works to avoid capturing these variables on python load... but I don't have PR for that yet. How about if we limit this to just COMPILER_WRAPPER for now.. we can extend it to other settings if there is demand and after a refactor. |
|
Closing in favor of a less broad solution: #12662 |
This means that the config setting
COMPILER_WRAPPERcanalso be set on the command line via
-s COMPILER_WRAPPER='foo'.Caveat: Using this feature ends up overriding he config setting
fairly late in the process which is too late for certain settings
to be overridden (for example -sLLVM_ROOT won't work because its
value is mostly used during startup when shared.py is first
imported. I'm have some factors planning to make this less
of a problem).
Fixes: #12340