From 66832138bfb0e82190b55fb410104d969cbc829b Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Thu, 30 Aug 2018 08:37:59 +0200 Subject: Allow user values on 'option env' symbols Gets rid of a check, doesn't hurt. The check was added before 'option env' was changed to just add a 'default' under the hood. Note: New Kconfig code doesn't need 'option env'. Environment variables are now expanded directly, including in the C tools. 'option env' is only maintained for backwards compatibility. --- kconfiglib.py | 9 +-------- testsuite.py | 8 ++------ 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/kconfiglib.py b/kconfiglib.py index 1d6a1e3..b7b5c24 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -3754,15 +3754,8 @@ class Symbol(object): "assignment ignored" .format(TRI_TO_STR[value] if value in (0, 1, 2) else "'{}'".format(value), - _name_and_loc(self), - TYPE_TO_STR[self.orig_type])) - - return False + _name_and_loc(self), TYPE_TO_STR[self.orig_type])) - if self.env_var is not None: - self.kconfig._warn("ignored attempt to assign user value to " - "{}, which is set from the environment" - .format(_name_and_loc(self))) return False if self.orig_type in (BOOL, TRISTATE) and value in ("n", "m", "y"): diff --git a/testsuite.py b/testsuite.py index e22c775..f7f75dd 100644 --- a/testsuite.py +++ b/testsuite.py @@ -1771,14 +1771,10 @@ tests/Krecursive2:1 os.environ["ENV_VAR"] = "ENV_VAR value" - # References undefined env. var. and tries to assign 'option env' variable, - # so disable warnings + # References undefined env. var., so disable warnings c = Kconfig("Kconfiglib/tests/Kmisc", warn=False) - # Verify that 'option env' symbols can't be assigned user values, and that - # 'option env' is treated like a default - assign_and_verify_user_value("FROM_ENV", "foo", None, False) - assign_and_verify_user_value("FROM_ENV_MISSING", "foo", None, False) + # Verify that 'option env' is treated like a default verify_value("FROM_ENV", "ENV_VAR value") verify_value("FROM_ENV_MISSING", "missing") -- cgit v1.2.3