diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-09 17:05:58 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-09 22:28:04 +0100 |
commit | 566628d8cd674a964d5824391cfd1585a1a22a87 (patch) | |
tree | 670366ee1492ff8bb18b9261dfab9d06c06b0a2d /meta/classes/package_ipk.bbclass | |
parent | d2ef952851d9ef16875fdbbbc6ae6eb6cfc10cc0 (diff) | |
download | poky-566628d8cd674a964d5824391cfd1585a1a22a87.tar.gz |
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>
Diffstat (limited to 'meta/classes/package_ipk.bbclass')
-rw-r--r-- | meta/classes/package_ipk.bbclass | 6 |
1 files changed, 3 insertions, 3 deletions
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 () { | |||
268 | controldir = os.path.join(root, 'CONTROL') | 268 | controldir = os.path.join(root, 'CONTROL') |
269 | bb.mkdirhier(controldir) | 269 | bb.mkdirhier(controldir) |
270 | try: | 270 | try: |
271 | ctrlfile = file(os.path.join(controldir, 'control'), 'w') | 271 | ctrlfile = open(os.path.join(controldir, 'control'), 'w') |
272 | except OSError: | 272 | except OSError: |
273 | bb.utils.unlockfile(lf) | 273 | bb.utils.unlockfile(lf) |
274 | raise bb.build.FuncFailed("unable to open control file for writing.") | 274 | raise bb.build.FuncFailed("unable to open control file for writing.") |
@@ -369,7 +369,7 @@ python do_package_ipk () { | |||
369 | if not scriptvar: | 369 | if not scriptvar: |
370 | continue | 370 | continue |
371 | try: | 371 | try: |
372 | scriptfile = file(os.path.join(controldir, script), 'w') | 372 | scriptfile = open(os.path.join(controldir, script), 'w') |
373 | except OSError: | 373 | except OSError: |
374 | bb.utils.unlockfile(lf) | 374 | bb.utils.unlockfile(lf) |
375 | raise bb.build.FuncFailed("unable to open %s script file for writing." % script) | 375 | raise bb.build.FuncFailed("unable to open %s script file for writing." % script) |
@@ -380,7 +380,7 @@ python do_package_ipk () { | |||
380 | conffiles_str = localdata.getVar("CONFFILES", True) | 380 | conffiles_str = localdata.getVar("CONFFILES", True) |
381 | if conffiles_str: | 381 | if conffiles_str: |
382 | try: | 382 | try: |
383 | conffiles = file(os.path.join(controldir, 'conffiles'), 'w') | 383 | conffiles = open(os.path.join(controldir, 'conffiles'), 'w') |
384 | except OSError: | 384 | except OSError: |
385 | bb.utils.unlockfile(lf) | 385 | bb.utils.unlockfile(lf) |
386 | raise bb.build.FuncFailed("unable to open conffiles for writing.") | 386 | raise bb.build.FuncFailed("unable to open conffiles for writing.") |