From 7a428aa415606820a44291f475248b08e3952c4b Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Sun, 15 Jul 2018 13:16:47 +0200 Subject: Switch to more sensible globbing statements (w/ backwards compatibility) Instead of having 'source' and 'gsource', have 'source' always glob, but require the pattern to match at least one file, throwing KconfigError otherwise. Have separate 'osource' and 'orsource' statements (the o is for "optional") for cases where it's okay for the pattern to not match any files. This is analogous to 'include' and '-include' in Make. The biggest flaw with 'gsource' was that there was no way to do a globbing match while requiring something to match, possibly leading to subtle failures. Preserve backwards compatibility by having "gsource" and "grsource" be aliases for "osource" and "orsource", respectively. Also include some related changes: - Kconfig.srctree is now set to the empty string if $srctree is unset, rather than to None. This gives nice behavior with os.path.join() and os.path.relpath(), which treat the empty string as the current directory (without adding './', for os.path.join()). - When $srctree is set, Kconfig files in the current directory will no longer override Kconfig files in $srctree when the relative paths match. This was likely a bug all along in the C tools, and probably only makes sense for .config files. I've seen it cause breakage in Zephyr. - Clarify the behavior of $srctree in the Kconfig.__init__() docstring. - Make MenuNode.filename be relative to $srctree for the Kconfig file passed to Kconfig.__init__(). This makes it consistent. The major version will be bumped later due to the small Kconfig.srctree API change. --- README.rst | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'README.rst') diff --git a/README.rst b/README.rst index 8f7e13f..efdaf6b 100644 --- a/README.rst +++ b/README.rst @@ -194,17 +194,19 @@ Kconfig language extensions ~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following Kconfig extensions are available: + +- ``source`` supports glob patterns and includes each matching file. At pattern + is required to match at least one file. + + A separate ``osource`` statement is available for cases where it's okay for + the pattern to match no files (in which case ``osource`` turns into a no-op). -- A relative ``source`` statement (``rsource``) where Kconfig - file paths are specified relative to the directory of - the current Kconfig file. - -- A globbing ``source`` (``gsource``) that doubles - as an include-if-exists function. +- A relative ``source`` statement (``rsource``) is available, where file paths + are specified relative to the directory of the current Kconfig file. An + ``orsource`` statement is available as well, analogous to ``osource``. -- Environment variables are expanded directly in e.g. ``source`` - and ``mainmenu`` statements, meaning ``option env`` symbols - are redundant. +- Environment variables are expanded directly in e.g. ``source`` and + ``mainmenu`` statements, meaning ``option env`` symbols are redundant. This is the standard behavior with the new `Kconfig preprocessor `_, -- cgit v1.2.3