bitbake: methodpool: Clean up the parsed module list handling to be slightly less insane
This removes some dubious functions and replaces them with a simpler, cleaner API which better describes what the code is doing. Unused code/variables are removed and comments tweaked. (Bitbake rev: f1e943aebfb84e98253f3f21646d6765c4fa1d66) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
43cbd5afce
commit
c8cce4e0d6
|
@ -33,9 +33,7 @@
|
||||||
from bb.utils import better_compile, better_exec
|
from bb.utils import better_compile, better_exec
|
||||||
from bb import error
|
from bb import error
|
||||||
|
|
||||||
# A dict of modules we have handled
|
# A dict of function names we have seen
|
||||||
# it is the number of .bbclasses + x in size
|
|
||||||
_parsed_methods = { }
|
|
||||||
_parsed_fns = { }
|
_parsed_fns = { }
|
||||||
|
|
||||||
def insert_method(modulename, code, fn):
|
def insert_method(modulename, code, fn):
|
||||||
|
@ -56,15 +54,18 @@ def insert_method(modulename, code, fn):
|
||||||
else:
|
else:
|
||||||
_parsed_fns[name] = modulename
|
_parsed_fns[name] = modulename
|
||||||
|
|
||||||
|
# A dict of modules the parser has finished with
|
||||||
|
_parsed_methods = {}
|
||||||
|
|
||||||
def parsed_module(modulename):
|
def parsed_module(modulename):
|
||||||
"""
|
"""
|
||||||
Inform me file xyz was parsed
|
Has module been parsed?
|
||||||
"""
|
"""
|
||||||
return modulename in _parsed_methods
|
return modulename in _parsed_methods
|
||||||
|
|
||||||
|
def set_parsed_module(modulename):
|
||||||
|
"""
|
||||||
|
Set module as parsed
|
||||||
|
"""
|
||||||
|
_parsed_methods[modulename] = True
|
||||||
|
|
||||||
def get_parsed_dict():
|
|
||||||
"""
|
|
||||||
shortcut
|
|
||||||
"""
|
|
||||||
return _parsed_methods
|
|
||||||
|
|
|
@ -31,7 +31,6 @@ import itertools
|
||||||
from bb import methodpool
|
from bb import methodpool
|
||||||
from bb.parse import logger
|
from bb.parse import logger
|
||||||
|
|
||||||
__parsed_methods__ = bb.methodpool.get_parsed_dict()
|
|
||||||
_bbversions_re = re.compile(r"\[(?P<from>[0-9]+)-(?P<to>[0-9]+)\]")
|
_bbversions_re = re.compile(r"\[(?P<from>[0-9]+)-(?P<to>[0-9]+)\]")
|
||||||
|
|
||||||
class StatementGroup(list):
|
class StatementGroup(list):
|
||||||
|
|
|
@ -161,7 +161,7 @@ def handle(fn, d, include):
|
||||||
|
|
||||||
# we have parsed the bb class now
|
# we have parsed the bb class now
|
||||||
if ext == ".bbclass" or ext == ".inc":
|
if ext == ".bbclass" or ext == ".inc":
|
||||||
bb.methodpool.get_parsed_dict()[base_name] = 1
|
bb.methodpool.set_parsed_module(base_name)
|
||||||
|
|
||||||
return d
|
return d
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue