Skip to contentSkip to conversation

kconfig: Kconfiglib: a flexible Python Kconfig parser

PATCH New Ulf Magnusson 1 participant 1 message Feb 6, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 kconfig: Kconfiglib: a flexible Python Kconfig parser

This patch builds on https://lkml.org/lkml/2011/2/5/174 . A compound patch (original patch + all fixes) is available at
http://dl.dropbox.com/u/10406197/kconfiglib.patch (apply with 'git am').

Changelog:
v3:
- Forgot to update the documentation for get_mainmenu_text() in v2.
- s/effect/affect/ in example 7.

v2:
- Now supports alternative output directories (O=).
- $-references were expanded as environment variables in some contexts ('source', 'mainmenu', and 'defconfig') where they should have been expanded as symbol values - fixed. The reason this broke so little is that all symbols whose value come from an environment variable are currently called the same thing as that variable.
- Added the internal special symbol UNAME_RELEASE, used by DEFCONFIG_LIST. Previously get_defconfig_filename() failed to find .configs whose DEFCONFIG_LIST entry involved UNAME_RELEASE - now works.
- get_defconfig_filename() now searches relative to $srctree before looking in the current directory, just like the C implementation.
- Updated example 1 to work regardless of build directory.
- Precompiled a few regexes.

---
Convenience links:

Latest documentation (generated with pydoc -w kconfiglib):
http://dl.dropbox.com/u/10406197/kconfiglib.html

Latest example files (ex1.py updated in v2):
http://dl.dropbox.com/u/10406197/kconfiglib-examples.tar.gz

 scripts/kconfig/kconfiglib.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
scripts/kconfig/kconfiglib.py +4 -4
index fa3d5ee..964e5cb 100644
@@ -323,7 +323,7 @@ while True:
 
                 sym.set_value(lower_bound)
 
-                # We just changed the value of some symbol. As this may effect
+                # We just changed the value of some symbol. As this may affect
                 # other symbols, keep going.
                 done = False
 
@@ -708,9 +708,9 @@ class Config():
         return self.arch
 
     def get_mainmenu_text(self):
-        """Returns the text of the 'mainmenu' statement (with environment
-        variables expanded to the value they had when the Config was created),
-        or None if the configuration has no 'mainmenu' statement."""
+        """Returns the text of the 'mainmenu' statement (with $-references to
+        symbols replaced by symbol values), or None if the configuration has no
+        'mainmenu' statement."""
         return self._expand_sym_refs(self.mainmenu_text)
 
     def get_defconfig_filename(self):
Signature · 1 line
1.7.0.4