From 8bef99d3c85f48ff409eaebb964b1c45b203bdcf Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 23 May 2013 10:47:10 +0100 Subject: bitbake: methodpool: Retire it, remove global method scope Having a global method scope confuses users and with the introduction of parallel parsing, its not even possible to correctly detect conflicting functions. Rather than try and fix that, its simpler to retire the global method scope and restrict functions to those locations they're defined within. This is more what users actually expect too. If we remove the global function scope, the need for methodpool is reduced to the point we may as well retire it. There is some small loss of caching of parsed functions but timing measurements so the impact to be neglibile in the overall parsing time. (Bitbake rev: 4d50690489ee8dc329a9b0c7bc4ceb29b71e95e9) Signed-off-by: Richard Purdie --- bitbake/lib/bb/parse/ast.py | 8 +++----- bitbake/lib/bb/parse/parse_py/BBHandler.py | 4 ---- 2 files changed, 3 insertions(+), 9 deletions(-) (limited to 'bitbake/lib/bb/parse') diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index b2657f8044..713bef1cc2 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py @@ -148,9 +148,8 @@ class MethodNode(AstNode): text = '\n'.join(self.body) if self.func_name == "__anonymous": funcname = ("__anon_%s_%s" % (self.lineno, self.filename.translate(string.maketrans('/.+-', '____')))) - if not funcname in bb.methodpool._parsed_fns: - text = "def %s(d):\n" % (funcname) + text - bb.methodpool.insert_method(funcname, text, self.filename) + text = "def %s(d):\n" % (funcname) + text + bb.methodpool.insert_method(funcname, text, self.filename) anonfuncs = data.getVar('__BBANONFUNCS') or [] anonfuncs.append(funcname) data.setVar('__BBANONFUNCS', anonfuncs) @@ -171,8 +170,7 @@ class PythonMethodNode(AstNode): # 'this' file. This means we will not parse methods from # bb classes twice text = '\n'.join(self.body) - if not bb.methodpool.parsed_module(self.modulename): - bb.methodpool.insert_method(self.modulename, text, self.filename) + bb.methodpool.insert_method(self.modulename, text, self.filename) data.setVarFlag(self.function, "func", 1) data.setVarFlag(self.function, "python", 1) data.setVar(self.function, text) diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index 87a1530cb5..01f22d3b24 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py @@ -167,10 +167,6 @@ def handle(fn, d, include): if oldfile: d.setVar("FILE", oldfile) - # we have parsed the bb class now - if ext == ".bbclass" or ext == ".inc": - bb.methodpool.set_parsed_module(base_name) - return d def feeder(lineno, s, fn, root, statements): -- cgit v1.2.3-54-g00ecf