summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2018-05-19 01:50:31 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2018-05-19 01:57:29 +0200
commitdf64ea5e98345775fd3ebbbccdec4140e0e0f617 (patch)
tree6467d903bf811839d2cec11bd688124f178baa88
parent36971bb127f3505a47cdf3d1f2e965ec12266247 (diff)
Warn for incompatible uses of 'option env=...'
Since commit cbf32e2 ("Expand environment variables in strings directly"), Kconfiglib expands environment variables directly in strings instead of using the 'option env=...' mechanism (this is planned for the C tools too). This new behavior is backwards-compatible as long as all 'option env=...' symbols have the same name as the environment variables they reference. Warn if 'option env="FOO"' appears on a symbol that isn't named FOO, to point out compatibility issues and help with debugging.
-rw-r--r--kconfiglib.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/kconfiglib.py b/kconfiglib.py
index b73ea10..4de8d40 100644
--- a/kconfiglib.py
+++ b/kconfiglib.py
@@ -2179,6 +2179,16 @@ class Kconfig(object):
"set".format(node.item.name, env_var),
self._filename, self._linenr)
+ if env_var != node.item.name:
+ self._warn("Kconfiglib expands environment variables "
+ "in strings directly, meaning you do not "
+ "need 'option env=...' \"bounce\" symbols. "
+ "For compatibility with the C tools, "
+ "rename {} to {} (so that the symbol name "
+ "matches the environment variable name)."
+ .format(node.item.name, env_var),
+ self._filename, self._linenr)
+
elif self._check_token(_T_DEFCONFIG_LIST):
if not self.defconfig_list:
self.defconfig_list = node.item