From 55cb2ec6db42e43c601f77bf4f03fb3a43725b24 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 2 Jun 2016 10:34:04 +0100 Subject: gitkpkgv: Ensure files are closed This avoids warnings with python 3. Signed-off-by: Richard Purdie Signed-off-by: Martin Jansa --- meta-oe/classes/gitpkgv.bbclass | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'meta-oe/classes') diff --git a/meta-oe/classes/gitpkgv.bbclass b/meta-oe/classes/gitpkgv.bbclass index 1cba00ca4..4866fac0b 100644 --- a/meta-oe/classes/gitpkgv.bbclass +++ b/meta-oe/classes/gitpkgv.bbclass @@ -87,11 +87,13 @@ def get_git_pkgv(d, use_tags): if commits != "": oe.path.remove(rev_file, recurse=False) - open(rev_file, "w").write("%d\n" % int(commits)) + with open(rev_file, "w") as f: + f.write("%d\n" % int(commits)) else: commits = "0" else: - commits = open(rev_file, "r").readline(128).strip() + with open(rev_file, "r") as f: + commits = f.readline(128).strip() if use_tags: try: -- cgit v1.2.3-54-g00ecf