diff --git a/oelint_parser/parser.py b/oelint_parser/parser.py index 721af5a..f5a8fe8 100644 --- a/oelint_parser/parser.py +++ b/oelint_parser/parser.py @@ -153,7 +153,7 @@ def get_items(stash, _file, lineOffset=0): res = [] __regex_var = r"^(?P([A-Z0-9a-z_.-]|\$|\{|\}|:)+?)(\[(?P(\w|-|\.)+)\])*(?P(\s|\t)*(\+|\?|\:|\.)*=(\+|\.)*(\s|\t)*)(?P.*)" __regex_func = r"^((?Ppython)\s*|(?Pfakeroot\s*))*(?P[\w\.\-\+\{\}:\$]+)?\s*\(\s*\)\s*\{(?P.*)\s*\}" - __regex_inherit = r"^.*?inherit(\s+|\t+)(?P.+)" + __regex_inherit = r"^(\s|\t)*inherit(\s+|\t+)(?P.+)" __regex_export_wval = r"^\s*?export(\s+|\t+)(?P.+)\s*=\s*\"(?P.*)\"" __regex_export_woval = r"^\s*?export(\s+|\t+)(?P.+)\s*$" __regex_comments = r"^(\s|\t)*#+\s*(?P.*)" diff --git a/tests/test-recipe_1.0.bb b/tests/test-recipe_1.0.bb index 175158a..c868586 100644 --- a/tests/test-recipe_1.0.bb +++ b/tests/test-recipe_1.0.bb @@ -47,6 +47,8 @@ require another_file.inc inherit someclass +A[doc] = "This string is not an inherit statement." + do_configure[noexec] = "1" export lib = "${bindir}/foo" diff --git a/tests/test_parser.py b/tests/test_parser.py index 9c623b5..68a364a 100644 --- a/tests/test_parser.py +++ b/tests/test_parser.py @@ -482,6 +482,21 @@ def test_append_to_stash(self): assert len(_stash) == 3 + def test_inherit(self): + from oelint_parser.cls_item import Variable + from oelint_parser.helper_files import expand_term + from oelint_parser.cls_stash import Stash + + self.__stash = Stash() + self.__stash.AddFile(OelintParserTest.RECIPE) + + _stash = self.__stash.GetItemsFor(classifier=Variable.CLASSIFIER, + attribute=Variable.ATTR_VAR, + attributeValue="inherit") + self.assertTrue(_stash, msg="Stash has no items") + self.assertEqual(len(_stash), 1, msg="Only one item is found") + for x in _stash: + self.assertEqual(x.VarValue, 'someclass') if __name__ == "__main__": unittest.main()