gitkpkgv: Ensure files are closed

This avoids warnings with python 3.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
Richard Purdie 2016-06-02 10:34:04 +01:00 committed by Martin Jansa
parent b4d7caaff9
commit 55cb2ec6db

View File

@ -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: