From 16c530c0cffe9cee67265d7b69b7973082bcc30a Mon Sep 17 00:00:00 2001 From: Chen Qi Date: Tue, 18 Dec 2018 14:53:43 +0800 Subject: 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'> (From OE-Core rev: 91810a57f0edd8b37c5f3f989a5aca69d9a40b37) (From OE-Core rev: f8c111891066609ed40d11fee61ca9e29b5b6029) Signed-off-by: Chen Qi Signed-off-by: Ross Burton Signed-off-by: Richard Purdie [Fixup for sumo context] Signed-off-by: Armin Kuster Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/classes/package.bbclass | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'meta/classes') diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index 109cf27254..6141a9582d 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass @@ -359,7 +359,8 @@ def append_source_info(file, sourcefile, d, fatal=True): # of rpm's debugedit, which was writing them out that way, and the code elsewhere # is still assuming that. debuglistoutput = '\0'.join(debugsources) + '\0' - open(sourcefile, 'a').write(debuglistoutput) + with open(sourcefile, 'a') as sf: + sf.write(debuglistoutput) def splitdebuginfo(file, debugfile, debugsrcdir, sourcefile, d): -- cgit v1.2.3-54-g00ecf