All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ast: Extract text variable in PythonMethodNode
@ 2012-08-22 12:54 Richard Purdie
  0 siblings, 0 replies; only message in thread
From: Richard Purdie @ 2012-08-22 12:54 UTC (permalink / raw)
  To: bitbake-devel

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index b7eaff1..dfc0b02 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -125,17 +125,18 @@ class MethodNode(AstNode):
         self.body = body
 
     def eval(self, data):
+        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) + '\n'.join(self.body)
+                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)
         else:
             data.setVarFlag(self.func_name, "func", 1)
-            data.setVar(self.func_name, '\n'.join(self.body))
+            data.setVar(self.func_name, text)
 
 class PythonMethodNode(AstNode):
     def __init__(self, filename, lineno, function, modulename, body):





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-08-22 13:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-22 12:54 [PATCH] ast: Extract text variable in PythonMethodNode Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.