]> code.ossystems Code Review - openembedded-core.git/commitdiff
bitbake/codeparser: Deal with functions with trailing whitespace
authorRichard Purdie <rpurdie@linux.intel.com>
Tue, 7 Sep 2010 13:33:53 +0000 (14:33 +0100)
committerRichard Purdie <rpurdie@linux.intel.com>
Tue, 7 Sep 2010 13:33:53 +0000 (14:33 +0100)
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
bitbake/lib/bb/codeparser.py

index 951bd47b88f40258798c9ec5c623837ac11053f8..7d40835cb845bc9cf6feab027a83f2066f85fcb3 100644 (file)
@@ -15,7 +15,14 @@ except ImportError:
 def check_indent(codestr):
     """If the code is indented, add a top level piece of code to 'remove' the indentation"""
 
-    if codestr[0] is " " or codestr[0] is " ":
+    i = 0
+    while codestr[i] in ["\n", "       ", " "]:
+        i = i + 1
+
+    if i == 0:
+        return codestr
+
+    if codestr[i-1] is "       " or codestr[i-1] is " ":
         return "if 1:\n" + codestr        
 
     return codestr