summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/methodpool.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/methodpool.py')
-rw-r--r--bitbake/lib/bb/methodpool.py42
1 files changed, 0 insertions, 42 deletions
diff --git a/bitbake/lib/bb/methodpool.py b/bitbake/lib/bb/methodpool.py
index 8ad23c650b..bf2e9f5542 100644
--- a/bitbake/lib/bb/methodpool.py
+++ b/bitbake/lib/bb/methodpool.py
@@ -17,24 +17,7 @@
17# with this program; if not, write to the Free Software Foundation, Inc., 17# with this program; if not, write to the Free Software Foundation, Inc.,
18# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 18# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 19
20
21"""
22 What is a method pool?
23
24 BitBake has a global method scope where .bb, .inc and .bbclass
25 files can install methods. These methods are parsed from strings.
26 To avoid recompiling and executing these string we introduce
27 a method pool to do this task.
28
29 This pool will be used to compile and execute the functions. It
30 will be smart enough to
31"""
32
33from bb.utils import better_compile, better_exec 20from bb.utils import better_compile, better_exec
34from bb import error
35
36# A dict of function names we have seen
37_parsed_fns = { }
38 21
39def insert_method(modulename, code, fn): 22def insert_method(modulename, code, fn):
40 """ 23 """
@@ -44,28 +27,3 @@ def insert_method(modulename, code, fn):
44 comp = better_compile(code, modulename, fn ) 27 comp = better_compile(code, modulename, fn )
45 better_exec(comp, None, code, fn) 28 better_exec(comp, None, code, fn)
46 29
47 # now some instrumentation
48 code = comp.co_names
49 for name in code:
50 if name in ['None', 'False']:
51 continue
52 elif name in _parsed_fns and not _parsed_fns[name] == modulename:
53 bb.fatal("The function %s defined in %s was already declared in %s. BitBake has a global python function namespace so shared functions should be declared in a common include file rather than being duplicated, or if the functions are different, please use different function names." % (name, modulename, _parsed_fns[name]))
54 else:
55 _parsed_fns[name] = modulename
56
57# A dict of modules the parser has finished with
58_parsed_methods = {}
59
60def parsed_module(modulename):
61 """
62 Has module been parsed?
63 """
64 return modulename in _parsed_methods
65
66def set_parsed_module(modulename):
67 """
68 Set module as parsed
69 """
70 _parsed_methods[modulename] = True
71