All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] gitkpkgv: Ensure files are closed
@ 2016-06-02  9:34 Richard Purdie
  2016-06-02  9:34 ` [PATCH 2/3] netmap-modules: Avoid type warning with python v3 Richard Purdie
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Richard Purdie @ 2016-06-02  9:34 UTC (permalink / raw)
  To: openembedded-devel; +Cc: Richard Purdie

This avoids warnings with python 3.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 meta-oe/classes/gitpkgv.bbclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/meta-oe/classes/gitpkgv.bbclass b/meta-oe/classes/gitpkgv.bbclass
index 1cba00c..4866fac 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:
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-06-10  6:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-02  9:34 [PATCH 1/3] gitkpkgv: Ensure files are closed Richard Purdie
2016-06-02  9:34 ` [PATCH 2/3] netmap-modules: Avoid type warning with python v3 Richard Purdie
2016-06-02  9:34 ` [PATCH 3/3] abiword/gnone-vfs: Use print as a function Richard Purdie
2016-06-07  9:02 ` [PATCH 1/3] gitkpkgv: Ensure files are closed Mike Looijmans
2016-06-07 13:49   ` Richard Purdie
2016-06-10  6:06     ` Mike Looijmans

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.