mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 00:20:08 +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:
@@ -227,7 +227,7 @@ python do_package_deb () {
|
||||
bb.mkdirhier(controldir)
|
||||
os.chmod(controldir, 0755)
|
||||
try:
|
||||
ctrlfile = file(os.path.join(controldir, 'control'), 'wb')
|
||||
ctrlfile = open(os.path.join(controldir, 'control'), 'w')
|
||||
# import codecs
|
||||
# ctrlfile = codecs.open("someFile", "w", "utf-8")
|
||||
except OSError:
|
||||
@@ -355,7 +355,7 @@ python do_package_deb () {
|
||||
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)
|
||||
@@ -367,7 +367,7 @@ python do_package_deb () {
|
||||
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