From 20de53b6a29fcfd2d91e815c5698b9b806a908f4 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Sat, 25 Aug 2018 07:21:02 +0200 Subject: Add a Kconfig.kconfig_filenames attribute Kconfig.kconfig_filenames is an ordered list of all Kconfig files included in the configuration, relative to $srctree. Can be used e.g. for custom incremental build implementations, though sync_deps() already indirectly catches any relevant changes to files. Piggyback some ' -> " quote style consistency cleanups. --- kconfiglib.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'kconfiglib.py') diff --git a/kconfiglib.py b/kconfiglib.py index 3b59363..5fdd9b7 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -466,6 +466,19 @@ class Kconfig(object): A list with all comments, in the same order as they appear in the Kconfig files + kconfig_filenames: + A list with the filenames of all Kconfig files included in the + configuration, relative to $srctree (or relative to the current directory + if $srctree isn't set). + + The files are listed in the order they are source'd, starting with the + top-level Kconfig file. If a file is source'd multiple times, it will + appear multiple times. Use set() to get unique filenames. + + Note: Using this for incremental builds is redundant. Kconfig.sync_deps() + already indirectly catches any file modifications that change the + configuration output. + n/m/y: The predefined constant symbols n/m/y. Also available in const_syms. @@ -570,6 +583,7 @@ class Kconfig(object): "const_syms", "defconfig_list", "defined_syms", + "kconfig_filenames", "m", "mainmenu_text", "menus", @@ -757,6 +771,9 @@ class Kconfig(object): # Parse the Kconfig files + # Not used internally. Provided as a convenience. + self.kconfig_filenames = [filename] + # These implement a single line of "unget" for the parser self._saved_line = None self._has_tokens = False @@ -1545,6 +1562,8 @@ class Kconfig(object): # self._filename (which makes it indirectly show up in # MenuNode.filename). Equals full_filename for absolute paths. + self.kconfig_filenames.append(rel_filename) + # The parent Kconfig files are represented as a list of # (, ) tuples. # @@ -2254,7 +2273,7 @@ class Kconfig(object): self._warn("the menuconfig symbol {} has no prompt" .format(_name_and_loc(sym))) - # Tricky Python semantics: This assign prev.next before prev + # Tricky Python semantics: This assigns prev.next before prev prev.next = prev = node elif t0 in (_T_SOURCE, _T_RSOURCE, _T_OSOURCE, _T_ORSOURCE): -- cgit v1.2.3