[oe-commits] [bitbake] 11/12: siggen: properly close files rather than opening them inline
git at git.openembedded.org
git at git.openembedded.org
Tue Aug 16 19:54:02 UTC 2016
rpurdie pushed a commit to branch master-next
in repository bitbake.
commit aba60e31919bcf651fbe0eaa2c863086deea08e5
Author: Paul Eggleton <paul.eggleton at linux.intel.com>
AuthorDate: Thu Aug 11 15:37:00 2016 +1200
siggen: properly close files rather than opening them inline
If you don't do this, with Python 3 you get a warning on exit under some
circumstances.
Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
lib/bb/siggen.py | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/lib/bb/siggen.py b/lib/bb/siggen.py
index 5d8a253..9b2f658 100644
--- a/lib/bb/siggen.py
+++ b/lib/bb/siggen.py
@@ -363,10 +363,12 @@ def clean_basepaths_list(a):
def compare_sigfiles(a, b, recursecb = None):
output = []
- p1 = pickle.Unpickler(open(a, "rb"))
- a_data = p1.load()
- p2 = pickle.Unpickler(open(b, "rb"))
- b_data = p2.load()
+ with open(a, 'rb') as f:
+ p1 = pickle.Unpickler(ff)
+ a_data = p1.load()
+ with open(b, 'rb') as f:
+ p2 = pickle.Unpickler(f)
+ b_data = p2.load()
def dict_diff(a, b, whitelist=set()):
sa = set(a.keys())
@@ -563,8 +565,9 @@ def calc_taskhash(sigdata):
def dump_sigfile(a):
output = []
- p1 = pickle.Unpickler(open(a, "rb"))
- a_data = p1.load()
+ with open(a, 'rb') as f:
+ p1 = pickle.Unpickler(f)
+ a_data = p1.load()
output.append("basewhitelist: %s" % (a_data['basewhitelist']))
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list