[oe-commits] [bitbake] 02/02: ConfHandler.py: allow require or include with multiple parameters

git at git.openembedded.org git at git.openembedded.org
Mon Jun 12 14:35:31 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 8d0a76f5a595dddf16b7268bae2c00ef5f568316
Author: Patrick Ohly <patrick.ohly at intel.com>
AuthorDate: Wed Jun 7 15:56:25 2017 +0200

    ConfHandler.py: allow require or include with multiple parameters
    
    "inherit" already allows inheriting more than one class in a single
    statement. The same also makes sense for "include" and "require",
    because then one can generate a list of files to be included
    dynamically also for the case that more than one file needs to be
    included.
    
    Signed-off-by: Patrick Ohly <patrick.ohly at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/parse/parse_py/ConfHandler.py | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/lib/bb/parse/parse_py/ConfHandler.py b/lib/bb/parse/parse_py/ConfHandler.py
index b006d06..97aa130 100644
--- a/lib/bb/parse/parse_py/ConfHandler.py
+++ b/lib/bb/parse/parse_py/ConfHandler.py
@@ -69,21 +69,25 @@ def init(data):
 def supports(fn, d):
     return fn[-5:] == ".conf"
 
-def include(parentfn, fn, lineno, data, error_out):
+def include(parentfn, fns, lineno, data, error_out):
     """
     error_out: A string indicating the verb (e.g. "include", "inherit") to be
     used in a ParseError that will be raised if the file to be included could
     not be included. Specify False to avoid raising an error in this case.
     """
-    if parentfn == fn: # prevent infinite recursion
-        return None
-
-    fn = data.expand(fn)
+    fns = data.expand(fns)
     parentfn = data.expand(parentfn)
 
-    if not fn:
-        # "include" or "require" without parameter is fine, just return.
-        return
+    # "include" or "require" accept zero to n space-separated file names to include.
+    for fn in fns.split():
+        include_single_file(parentfn, fn, lineno, data, error_out)
+
+def include_single_file(parentfn, fn, lineno, data, error_out):
+    """
+    Helper function for include() which does not expand or split its parameters.
+    """
+    if parentfn == fn: # prevent infinite recursion
+        return None
 
     if not os.path.isabs(fn):
         dname = os.path.dirname(parentfn)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list