mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 12:29:55 +00:00
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 (From OE-Core rev: a43e0a8ecd0441131e929daf998c3cd454d9c8f3) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -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.")
|
||||
|
||||
Reference in New Issue
Block a user