diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-09 21:06:45 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-09 22:26:29 +0100 |
commit | 9f08b901375ba640f47596f1bcf43f98a931550f (patch) | |
tree | 061dade29876b4ef187460c166cbad15a1f485ae /lib/bb/parse | |
parent | 3627b02f77c78beedadadd77c619b9e5edaae076 (diff) | |
download | bitbake-contrib-9f08b901375ba640f47596f1bcf43f98a931550f.tar.gz |
lib: Clean up various file access syntax
Python 3 is stricter about how files are accessed. Specficially:
* Use open(), not file()
* Use binary mode for binary files (when checksumming)
* Use with statements to ensure files get closed
* Add missing file close statements
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/parse')
-rw-r--r-- | lib/bb/parse/parse_py/BBHandler.py | 1 | ||||
-rw-r--r-- | lib/bb/parse/parse_py/ConfHandler.py | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/lib/bb/parse/parse_py/BBHandler.py b/lib/bb/parse/parse_py/BBHandler.py index 81fb8d3ad..87a1530cb 100644 --- a/lib/bb/parse/parse_py/BBHandler.py +++ b/lib/bb/parse/parse_py/BBHandler.py @@ -104,6 +104,7 @@ def get_statements(filename, absolute_filename, base_name): if not s: break s = s.rstrip() feeder(lineno, s, filename, base_name, statements) + file.close() if __inpython__: # add a blank line to close out any python definition feeder(IN_PYTHON_EOF, "", filename, base_name, statements) diff --git a/lib/bb/parse/parse_py/ConfHandler.py b/lib/bb/parse/parse_py/ConfHandler.py index 3255c8beb..7d4a5b14a 100644 --- a/lib/bb/parse/parse_py/ConfHandler.py +++ b/lib/bb/parse/parse_py/ConfHandler.py @@ -145,6 +145,8 @@ def handle(fn, data, include): if oldfile: data.setVar('FILE', oldfile) + f.close() + for f in confFilters: f(fn, data) |