summaryrefslogtreecommitdiff
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-09-07 14:33:53 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-09-07 14:33:53 +0100
commit647713050b091e55497aee5647b6d0d0abc08411 (patch)
treecdade357ee25230407780993eaeaefab58cd402d /bitbake/lib/bb
parent1c24729697a75a7bac325e26b9c1102aa6b08a3d (diff)
downloadopenembedded-core-647713050b091e55497aee5647b6d0d0abc08411.tar.gz
openembedded-core-647713050b091e55497aee5647b6d0d0abc08411.tar.bz2
openembedded-core-647713050b091e55497aee5647b6d0d0abc08411.tar.xz
openembedded-core-647713050b091e55497aee5647b6d0d0abc08411.zip
bitbake/codeparser: Deal with functions with trailing whitespace
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/codeparser.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/bitbake/lib/bb/codeparser.py b/bitbake/lib/bb/codeparser.py
index 951bd47b8..7d40835cb 100644
--- a/bitbake/lib/bb/codeparser.py
+++ b/bitbake/lib/bb/codeparser.py
@@ -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