summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake-dev/lib/bb/parse/parse_py/BBHandler.py29
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py29
2 files changed, 34 insertions, 24 deletions
diff --git a/bitbake-dev/lib/bb/parse/parse_py/BBHandler.py b/bitbake-dev/lib/bb/parse/parse_py/BBHandler.py
index f92b31fd0a..f13bb015ba 100644
--- a/bitbake-dev/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake-dev/lib/bb/parse/parse_py/BBHandler.py
@@ -25,7 +25,7 @@
25# with this program; if not, write to the Free Software Foundation, Inc., 25# with this program; if not, write to the Free Software Foundation, Inc.,
26# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 26# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 27
28import re, bb, os, sys, time 28import re, bb, os, sys, time, string
29import bb.fetch, bb.build, bb.utils 29import bb.fetch, bb.build, bb.utils
30from bb import data, fetch, methodpool 30from bb import data, fetch, methodpool
31 31
@@ -89,7 +89,12 @@ def finalise(fn, d):
89 try: 89 try:
90 t = data.getVar('T', d) 90 t = data.getVar('T', d)
91 data.setVar('T', '${TMPDIR}/anonfunc/', d) 91 data.setVar('T', '${TMPDIR}/anonfunc/', d)
92 build.exec_func("__anonfunc", d) 92 anonfuncs = data.getVar('__BBANONFUNCS', d) or []
93 code = ""
94 for f in anonfuncs:
95 code = code + " %s(d)\n" % f
96 data.setVar("__anonfunc", code, d)
97 build.exec_func_python("__anonfunc", d)
93 data.delVar('T', d) 98 data.delVar('T', d)
94 if t: 99 if t:
95 data.setVar('T', t, d) 100 data.setVar('T', t, d)
@@ -211,17 +216,17 @@ def feeder(lineno, s, fn, root, d):
211 if __infunc__: 216 if __infunc__:
212 if s == '}': 217 if s == '}':
213 __body__.append('') 218 __body__.append('')
214 data.setVar(__infunc__, '\n'.join(__body__), d)
215 data.setVarFlag(__infunc__, "func", 1, d)
216 if __infunc__ == "__anonymous": 219 if __infunc__ == "__anonymous":
217 anonqueue = bb.data.getVar("__anonqueue", d) or [] 220 funcname = ("__anon_%s_%s" % (lineno, fn.translate(string.maketrans('/.+-', '____'))))
218 anonitem = {} 221 if not funcname in methodpool._parsed_fns:
219 anonitem["content"] = bb.data.getVar("__anonymous", d) 222 text = "def %s(d):\n" % (funcname) + '\n'.join(__body__)
220 anonitem["flags"] = bb.data.getVarFlags("__anonymous", d) 223 methodpool.insert_method(funcname, text, fn)
221 anonqueue.append(anonitem) 224 anonfuncs = data.getVar('__BBANONFUNCS', d) or []
222 bb.data.setVar("__anonqueue", anonqueue, d) 225 anonfuncs.append(funcname)
223 bb.data.delVarFlags("__anonymous", d) 226 data.setVar('__BBANONFUNCS', anonfuncs, d)
224 bb.data.delVar("__anonymous", d) 227 else:
228 data.setVarFlag(__infunc__, "func", 1, d)
229 data.setVar(__infunc__, '\n'.join(__body__), d)
225 __infunc__ = "" 230 __infunc__ = ""
226 __body__ = [] 231 __body__ = []
227 else: 232 else:
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index e918ce3bb8..03976d4d8c 100644
--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -25,7 +25,7 @@
25# with this program; if not, write to the Free Software Foundation, Inc., 25# with this program; if not, write to the Free Software Foundation, Inc.,
26# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 26# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
27 27
28import re, bb, os, sys, time 28import re, bb, os, sys, time, string
29import bb.fetch, bb.build, bb.utils 29import bb.fetch, bb.build, bb.utils
30from bb import data, fetch, methodpool 30from bb import data, fetch, methodpool
31 31
@@ -89,7 +89,12 @@ def finalise(fn, d):
89 try: 89 try:
90 t = data.getVar('T', d) 90 t = data.getVar('T', d)
91 data.setVar('T', '${TMPDIR}/', d) 91 data.setVar('T', '${TMPDIR}/', d)
92 build.exec_func("__anonfunc", d) 92 anonfuncs = data.getVar('__BBANONFUNCS', d) or []
93 code = ""
94 for f in anonfuncs:
95 code = code + " %s(d)\n" % f
96 data.setVar("__anonfunc", code, d)
97 build.exec_func_python("__anonfunc", d)
93 data.delVar('T', d) 98 data.delVar('T', d)
94 if t: 99 if t:
95 data.setVar('T', t, d) 100 data.setVar('T', t, d)
@@ -205,17 +210,17 @@ def feeder(lineno, s, fn, root, d):
205 if __infunc__: 210 if __infunc__:
206 if s == '}': 211 if s == '}':
207 __body__.append('') 212 __body__.append('')
208 data.setVar(__infunc__, '\n'.join(__body__), d)
209 data.setVarFlag(__infunc__, "func", 1, d)
210 if __infunc__ == "__anonymous": 213 if __infunc__ == "__anonymous":
211 anonqueue = bb.data.getVar("__anonqueue", d) or [] 214 funcname = ("__anon_%s_%s" % (lineno, fn.translate(string.maketrans('/.+-', '____'))))
212 anonitem = {} 215 if not funcname in methodpool._parsed_fns:
213 anonitem["content"] = bb.data.getVar("__anonymous", d) 216 text = "def %s(d):\n" % (funcname) + '\n'.join(__body__)
214 anonitem["flags"] = bb.data.getVarFlags("__anonymous", d) 217 methodpool.insert_method(funcname, text, fn)
215 anonqueue.append(anonitem) 218 anonfuncs = data.getVar('__BBANONFUNCS', d) or []
216 bb.data.setVar("__anonqueue", anonqueue, d) 219 anonfuncs.append(funcname)
217 bb.data.delVarFlags("__anonymous", d) 220 data.setVar('__BBANONFUNCS', anonfuncs, d)
218 bb.data.delVar("__anonymous", d) 221 else:
222 data.setVarFlag(__infunc__, "func", 1, d)
223 data.setVar(__infunc__, '\n'.join(__body__), d)
219 __infunc__ = "" 224 __infunc__ = ""
220 __body__ = [] 225 __body__ = []
221 else: 226 else: