1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-08 17:19:20 +00:00

bitbake/codeparser: Deal with functions with trailing whitespace

Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
Richard Purdie
2010-09-07 14:33:53 +01:00
parent 1c24729697
commit 647713050b
+8 -1
View 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