summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChen Qi <Qi.Chen@windriver.com>2018-12-18 14:53:43 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-01-03 21:14:47 +0000
commit91810a57f0edd8b37c5f3f989a5aca69d9a40b37 (patch)
tree26eed765751cb7169b39dd2bebfc035459ed95c6
parente2f863e13d33b193b1b5b1ba08f574776a210ac1 (diff)
downloadopenembedded-core-contrib-91810a57f0edd8b37c5f3f989a5aca69d9a40b37.tar.gz
openembedded-core-contrib-91810a57f0edd8b37c5f3f989a5aca69d9a40b37.tar.bz2
openembedded-core-contrib-91810a57f0edd8b37c5f3f989a5aca69d9a40b37.zip
package.bbclass: fix python unclosed file ResourceWarning
Fix the following warning. ResourceWarning: unclosed file <_io.TextIOWrapper name='/.../systemd/1_239-r0/debugsources.list' mode='a' encoding='UTF-8'> Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/package.bbclass3
1 files changed, 2 insertions, 1 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index d1e9138c66..0fe9576b4d 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -368,7 +368,8 @@ def append_source_info(file, sourcefile, d, fatal=True):
# is still assuming that.
debuglistoutput = '\0'.join(debugsources) + '\0'
lf = bb.utils.lockfile(sourcefile + ".lock")
- open(sourcefile, 'a').write(debuglistoutput)
+ with open(sourcefile, 'a') as sf:
+ sf.write(debuglistoutput)
bb.utils.unlockfile(lf)