From a43e0a8ecd0441131e929daf998c3cd454d9c8f3 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 9 May 2013 17:05:58 +0100 Subject: class/lib: Fix up various file access methods There are various bits of cruft that have built up around our file accesses. This patch cleans some of them up, specifically: * Remove pointless "from __builtin__ import file" * Use open(), not file() * Wrap file usage in a with container to ensure files are closed * Add missing .close() calls in some cases Signed-off-by: Richard Purdie --- meta/classes/package_ipk.bbclass | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'meta/classes/package_ipk.bbclass') diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass index 5873f71205..f6797ada9d 100644 --- a/meta/classes/package_ipk.bbclass +++ b/meta/classes/package_ipk.bbclass @@ -268,7 +268,7 @@ python do_package_ipk () { controldir = os.path.join(root, 'CONTROL') bb.mkdirhier(controldir) try: - ctrlfile = file(os.path.join(controldir, 'control'), 'w') + ctrlfile = open(os.path.join(controldir, 'control'), 'w') except OSError: bb.utils.unlockfile(lf) raise bb.build.FuncFailed("unable to open control file for writing.") @@ -369,7 +369,7 @@ python do_package_ipk () { if not scriptvar: continue try: - scriptfile = file(os.path.join(controldir, script), 'w') + scriptfile = open(os.path.join(controldir, script), 'w') except OSError: bb.utils.unlockfile(lf) raise bb.build.FuncFailed("unable to open %s script file for writing." % script) @@ -380,7 +380,7 @@ python do_package_ipk () { conffiles_str = localdata.getVar("CONFFILES", True) if conffiles_str: try: - conffiles = file(os.path.join(controldir, 'conffiles'), 'w') + conffiles = open(os.path.join(controldir, 'conffiles'), 'w') except OSError: bb.utils.unlockfile(lf) raise bb.build.FuncFailed("unable to open conffiles for writing.") -- cgit 1.2.3-korg