diff options
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/BBHandler.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index f2a215105b..fe918a41f3 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py | |||
@@ -87,17 +87,17 @@ def get_statements(filename, absolute_filename, base_name): | |||
87 | try: | 87 | try: |
88 | return cached_statements[absolute_filename] | 88 | return cached_statements[absolute_filename] |
89 | except KeyError: | 89 | except KeyError: |
90 | file = open(absolute_filename, 'r') | 90 | with open(absolute_filename, 'r') as f: |
91 | statements = ast.StatementGroup() | 91 | statements = ast.StatementGroup() |
92 | 92 | ||
93 | lineno = 0 | 93 | lineno = 0 |
94 | while True: | 94 | while True: |
95 | lineno = lineno + 1 | 95 | lineno = lineno + 1 |
96 | s = file.readline() | 96 | s = f.readline() |
97 | if not s: break | 97 | if not s: break |
98 | s = s.rstrip() | 98 | s = s.rstrip() |
99 | feeder(lineno, s, filename, base_name, statements) | 99 | feeder(lineno, s, filename, base_name, statements) |
100 | file.close() | 100 | |
101 | if __inpython__: | 101 | if __inpython__: |
102 | # add a blank line to close out any python definition | 102 | # add a blank line to close out any python definition |
103 | feeder(lineno, "", filename, base_name, statements, eof=True) | 103 | feeder(lineno, "", filename, base_name, statements, eof=True) |