diff options
Diffstat (limited to 'bitbake/lib/bb/parse/parse_py/ConfHandler.py')
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/ConfHandler.py | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py index 2e84b913d8..af64d3446e 100644 --- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py +++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py | |||
@@ -119,30 +119,30 @@ def handle(fn, data, include): | |||
119 | oldfile = data.getVar('FILE', False) | 119 | oldfile = data.getVar('FILE', False) |
120 | 120 | ||
121 | abs_fn = resolve_file(fn, data) | 121 | abs_fn = resolve_file(fn, data) |
122 | f = open(abs_fn, 'r') | 122 | with open(abs_fn, 'r') as f: |
123 | 123 | ||
124 | statements = ast.StatementGroup() | 124 | statements = ast.StatementGroup() |
125 | lineno = 0 | 125 | lineno = 0 |
126 | while True: | 126 | while True: |
127 | lineno = lineno + 1 | ||
128 | s = f.readline() | ||
129 | if not s: | ||
130 | break | ||
131 | w = s.strip() | ||
132 | # skip empty lines | ||
133 | if not w: | ||
134 | continue | ||
135 | s = s.rstrip() | ||
136 | while s[-1] == '\\': | ||
137 | s2 = f.readline().rstrip() | ||
138 | lineno = lineno + 1 | 127 | lineno = lineno + 1 |
139 | if (not s2 or s2 and s2[0] != "#") and s[0] == "#" : | 128 | s = f.readline() |
140 | bb.fatal("There is a confusing multiline, partially commented expression on line %s of file %s (%s).\nPlease clarify whether this is all a comment or should be parsed." % (lineno, fn, s)) | 129 | if not s: |
141 | s = s[:-1] + s2 | 130 | break |
142 | # skip comments | 131 | w = s.strip() |
143 | if s[0] == '#': | 132 | # skip empty lines |
144 | continue | 133 | if not w: |
145 | feeder(lineno, s, abs_fn, statements) | 134 | continue |
135 | s = s.rstrip() | ||
136 | while s[-1] == '\\': | ||
137 | s2 = f.readline().rstrip() | ||
138 | lineno = lineno + 1 | ||
139 | if (not s2 or s2 and s2[0] != "#") and s[0] == "#" : | ||
140 | bb.fatal("There is a confusing multiline, partially commented expression on line %s of file %s (%s).\nPlease clarify whether this is all a comment or should be parsed." % (lineno, fn, s)) | ||
141 | s = s[:-1] + s2 | ||
142 | # skip comments | ||
143 | if s[0] == '#': | ||
144 | continue | ||
145 | feeder(lineno, s, abs_fn, statements) | ||
146 | 146 | ||
147 | # DONE WITH PARSING... time to evaluate | 147 | # DONE WITH PARSING... time to evaluate |
148 | data.setVar('FILE', abs_fn) | 148 | data.setVar('FILE', abs_fn) |