summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/parse
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-09 21:06:45 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-09 22:28:04 +0100
commit4a081b5a52e3d27da8d4b062f3fda292e8d8fb0a (patch)
treea555b39b41e4ec36c212481fcd2887cde2ee30dd /bitbake/lib/bb/parse
parent7f2bf08280f11daa002f4a9e870c2b77711cbf90 (diff)
downloadpoky-4a081b5a52e3d27da8d4b062f3fda292e8d8fb0a.tar.gz
bitbake: 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 (Bitbake rev: 9f08b901375ba640f47596f1bcf43f98a931550f) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/parse')
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py1
-rw-r--r--bitbake/lib/bb/parse/parse_py/ConfHandler.py2
2 files changed, 3 insertions, 0 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index 81fb8d3adf..87a1530cb5 100644
--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -104,6 +104,7 @@ def get_statements(filename, absolute_filename, base_name):
104 if not s: break 104 if not s: break
105 s = s.rstrip() 105 s = s.rstrip()
106 feeder(lineno, s, filename, base_name, statements) 106 feeder(lineno, s, filename, base_name, statements)
107 file.close()
107 if __inpython__: 108 if __inpython__:
108 # add a blank line to close out any python definition 109 # add a blank line to close out any python definition
109 feeder(IN_PYTHON_EOF, "", filename, base_name, statements) 110 feeder(IN_PYTHON_EOF, "", filename, base_name, statements)
diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
index 3255c8beb8..7d4a5b14a7 100644
--- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
@@ -145,6 +145,8 @@ def handle(fn, data, include):
145 if oldfile: 145 if oldfile:
146 data.setVar('FILE', oldfile) 146 data.setVar('FILE', oldfile)
147 147
148 f.close()
149
148 for f in confFilters: 150 for f in confFilters:
149 f(fn, data) 151 f(fn, data)
150 152