[oe-commits] [bitbake] 07/07: BBHandler: Fix __python_func_regexp__ for comment lines

git at git.openembedded.org git at git.openembedded.org
Fri Nov 16 14:03:12 UTC 2018


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

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

commit 79e62eef1c93f742bf71e9f25db57fdd2ffedd02
Author: Robert Yang <liezhi.yang at windriver.com>
AuthorDate: Wed Nov 14 17:46:41 2018 +0800

    BBHandler: Fix __python_func_regexp__ for comment lines
    
    Fixed:
    - Add a comment in base.bbclass:
      def oe_import(d):
          import sys
      # Comment
          bbpath = d.getVar("BBPATH").split(":")
      [snip]
    
      Note, '# Comment' is started with '#', it is legal in python's syntax
      (though maybe not a good style), but bitbake reported errors:
    
      $ bitbake -p
      ERROR: ParseError at /path/to/base.bbclass:20: unparsed line: '    bbpath = d.getVar("BBPATH").split(":")'
    
      This error report would mislead people, the real problem is that '# Comment'
      is not supported, but it reports the next line, this may make it hard to debug
      the code are complicated.
    
    We can make __python_func_regexp__ handle '^#' to fix the problem, since it
    already can handle blank line "^$" in a python function, so it would be pretty
    safe to handle "^#" as well.
    
    Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/parse/parse_py/BBHandler.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/bb/parse/parse_py/BBHandler.py b/lib/bb/parse/parse_py/BBHandler.py
index e5039e3..01fc47e 100644
--- a/lib/bb/parse/parse_py/BBHandler.py
+++ b/lib/bb/parse/parse_py/BBHandler.py
@@ -45,7 +45,7 @@ __addtask_regexp__       = re.compile("addtask\s+(?P<func>\w+)\s*((before\s*(?P<
 __deltask_regexp__       = re.compile("deltask\s+(?P<func>\w+)")
 __addhandler_regexp__    = re.compile( r"addhandler\s+(.+)" )
 __def_regexp__           = re.compile( r"def\s+(\w+).*:" )
-__python_func_regexp__   = re.compile( r"(\s+.*)|(^$)" )
+__python_func_regexp__   = re.compile( r"(\s+.*)|(^$)|(^#)" )
 
 __infunc__ = []
 __inpython__ = False

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


More information about the Openembedded-commits mailing list