From df64ea5e98345775fd3ebbbccdec4140e0e0f617 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Sat, 19 May 2018 01:50:31 +0200 Subject: 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. --- kconfiglib.py | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 -- cgit v1.2.3