diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-05-27 04:50:06 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-05-27 04:59:33 +0200 |
| commit | 7427079f008155f0901a5d53f9f1d4175381a585 (patch) | |
| tree | 77d3ab7fe3264e20fc9fbf6bfd6440f72791d47c | |
| parent | 1c81db1a573b930f80df176ef3012b6159e0598a (diff) | |
Get rid of the predefined UNAME_RELEASE symbol
Commit cbf32e2 ("Expand environment variables in strings directly")
added direct expansion of environment variables is strings, with commit
b9384a1 ("Restore compatibility with $UNAME_RELEASE") adding a hack to
restore compatibility with the predefined $UNAME_RELEASE symbol, used by
DEFCONFIG_LIST in the Linux kernel.
With the compatibility hack in place, there's no longer any need to
define UNAME_RELEASE as a proper symbol. Remove it.
| -rw-r--r-- | kconfiglib.py | 18 | ||||
| -rw-r--r-- | testsuite.py | 18 |
2 files changed, 5 insertions, 31 deletions
diff --git a/kconfiglib.py b/kconfiglib.py index 99635fe..99c75d0 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -658,17 +658,6 @@ class Kconfig(object): self.modules = self._lookup_sym("MODULES") self.defconfig_list = None - # The only predefined symbol besides n/m/y. DEFCONFIG_LIST uses this as - # of writing. - uname_sym = self._lookup_const_sym("UNAME_RELEASE") - uname_sym.orig_type = STRING - # env_var doubles as the SYMBOL_AUTO flag from the C implementation, so - # just set it to something. The naming breaks a bit here. - uname_sym.env_var = "<uname release>" - uname_sym.defaults.append( - (self._lookup_const_sym(platform.uname()[2]), self.y)) - self.syms["UNAME_RELEASE"] = uname_sym - self.top_node = MenuNode() self.top_node.kconfig = self self.top_node.item = MENU @@ -2880,9 +2869,6 @@ class Symbol(object): 'option env="FOO"' acts like a 'default' property whose value is the value of $FOO. - env_var is set to "<uname release>" for the predefined symbol - UNAME_RELEASE, which holds the 'release' field from uname. - Symbols with 'option env' are never written out to .config files, even if they are visible. env_var corresponds to a flag called SYMBOL_AUTO in the C implementation. @@ -4537,8 +4523,8 @@ def _make_depend_on(sym, expr): "expression with token stream {}.".format(expr)) def _expand(s): - # The predefined UNAME_RELEASE symbol is expanded in one of the 'default's - # of the DEFCONFIG_LIST symbol in the Linux kernel. This function maintains + # A predefined UNAME_RELEASE symbol is expanded in one of the 'default's of + # the DEFCONFIG_LIST symbol in the Linux kernel. This function maintains # compatibility with it even though environment variables in strings are # now expanded directly. diff --git a/testsuite.py b/testsuite.py index 1d79fa6..9faa92c 100644 --- a/testsuite.py +++ b/testsuite.py @@ -825,7 +825,7 @@ comment "advanced comment" print("Testing Kconfig.__repr__()") verify_repr(c, """ -<configuration with 15 symbols, main menu prompt "Linux Kernel Configuration", srctree not set, config symbol prefix "CONFIG_", warnings disabled, printing of warnings to stderr enabled, undef. symbol assignment warnings disabled, redundant symbol assignment warnings enabled> +<configuration with 14 symbols, main menu prompt "Linux Kernel Configuration", srctree not set, config symbol prefix "CONFIG_", warnings disabled, printing of warnings to stderr enabled, undef. symbol assignment warnings disabled, redundant symbol assignment warnings enabled> """) os.environ["srctree"] = "srctree value" @@ -838,7 +838,7 @@ comment "advanced comment" c.enable_undef_warnings() verify_repr(c, """ -<configuration with 15 symbols, main menu prompt "Linux Kernel Configuration", srctree "srctree value", config symbol prefix "CONFIG_ value", warnings enabled, printing of warnings to stderr disabled, undef. symbol assignment warnings enabled, redundant symbol assignment warnings disabled> +<configuration with 14 symbols, main menu prompt "Linux Kernel Configuration", srctree "srctree value", config symbol prefix "CONFIG_ value", warnings enabled, printing of warnings to stderr disabled, undef. symbol assignment warnings enabled, redundant symbol assignment warnings disabled> """) os.environ.pop("srctree", None) @@ -1134,7 +1134,6 @@ g verify_const_unassignable("m") verify_const_unassignable("y") verify_const_unassignable("const") - verify_const_unassignable("UNAME_RELEASE") verify_assignable("UNDEFINED", (), ()) verify_assignable("NO_PROMPT", (), ()) verify_assignable("STRING", (), ()) @@ -1535,16 +1534,6 @@ g "ALLNOCONFIG_Y should be allnoconfig_y") - print("Testing UNAME_RELEASE") - - verify_value("UNAME_RELEASE", platform.uname()[2]) - ur = c.syms["UNAME_RELEASE"] - verify(ur.kconfig is c and - ur.type == STRING and - ur.env_var == "<uname release>", - "UNAME_RELEASE has wrong fields") - - print("Testing .config reading and writing") config_test_file = "Kconfiglib/tests/config_test" @@ -2042,8 +2031,7 @@ def test_sanity(conf, arch, srcarch): for key, sym in conf.syms.items(): verify(isinstance(key, str), "weird key '{}' in syms dict".format(key)) - if sym.name != "UNAME_RELEASE": - verify(not sym.is_constant, sym.name + " in 'syms' and constant") + verify(not sym.is_constant, sym.name + " in 'syms' and constant") verify(sym not in conf.const_syms, sym.name + " in both 'syms' and 'const_syms'") |
