diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-06-02 10:34:04 +0100 |
---|---|---|
committer | Martin Jansa <Martin.Jansa@gmail.com> | 2016-06-08 14:55:26 +0200 |
commit | 55cb2ec6db42e43c601f77bf4f03fb3a43725b24 (patch) | |
tree | dac9e31d9f816421c6fdf6eb682c1971ce82a080 /meta-oe/classes | |
parent | b4d7caaff9ee7e3ba2f5756b3d2ea2de498d4c2f (diff) | |
download | meta-openembedded-55cb2ec6db42e43c601f77bf4f03fb3a43725b24.tar.gz |
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>
Diffstat (limited to 'meta-oe/classes')
-rw-r--r-- | meta-oe/classes/gitpkgv.bbclass | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/meta-oe/classes/gitpkgv.bbclass b/meta-oe/classes/gitpkgv.bbclass index 1cba00ca4d..4866fac0bd 100644 --- a/meta-oe/classes/gitpkgv.bbclass +++ b/meta-oe/classes/gitpkgv.bbclass | |||
@@ -87,11 +87,13 @@ def get_git_pkgv(d, use_tags): | |||
87 | 87 | ||
88 | if commits != "": | 88 | if commits != "": |
89 | oe.path.remove(rev_file, recurse=False) | 89 | oe.path.remove(rev_file, recurse=False) |
90 | open(rev_file, "w").write("%d\n" % int(commits)) | 90 | with open(rev_file, "w") as f: |
91 | f.write("%d\n" % int(commits)) | ||
91 | else: | 92 | else: |
92 | commits = "0" | 93 | commits = "0" |
93 | else: | 94 | else: |
94 | commits = open(rev_file, "r").readline(128).strip() | 95 | with open(rev_file, "r") as f: |
96 | commits = f.readline(128).strip() | ||
95 | 97 | ||
96 | if use_tags: | 98 | if use_tags: |
97 | try: | 99 | try: |