[oe-commits] [openembedded-core] 10/49: package.bbclass: fix python unclosed file ResourceWarning

git at git.openembedded.org git at git.openembedded.org
Mon Feb 25 22:28:16 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch sumo
in repository openembedded-core.

commit f8c111891066609ed40d11fee61ca9e29b5b6029
Author: Chen Qi <Qi.Chen at windriver.com>
AuthorDate: Tue Dec 18 14:53:43 2018 +0800

    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)
    
    Signed-off-by: Chen Qi <Qi.Chen at windriver.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
    [Fixup for sumo context]
    Signed-off-by: Armin Kuster <akuster808 at gmail.com>
    
    Signed-off-by: Armin Kuster <akuster808 at gmail.com>
---
 meta/classes/package.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 109cf27..6141a95 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):

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list