From: Jan Kiszka <jan.kiszka@siemens.com>
To: isar-users <isar-users@googlegroups.com>
Subject: [PATCH 5/6] oe.types.path: Use with to control file handle lifetime
Date: Tue, 10 Dec 2019 19:34:24 +0100 [thread overview]
Message-ID: <5c06e579d1f5e9148920c4241d6ca3b94fc2d6be.1576002865.git.jan.kiszka@siemens.com> (raw)
In-Reply-To: <cover.1576002865.git.jan.kiszka@siemens.com>
In-Reply-To: <cover.1576002865.git.jan.kiszka@siemens.com>
From: Ola x Nilsson <ola.x.nilsson@axis.com>
Signed-off-by: Ola x Nilsson <olani@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
[Jan: imported from OE-core b6e7fee68d018e5f148a7a02cf110bc210022a72]
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
meta/lib/oe/types.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/meta/lib/oe/types.py b/meta/lib/oe/types.py
index ad8dd36..4927fbc 100644
--- a/meta/lib/oe/types.py
+++ b/meta/lib/oe/types.py
@@ -156,7 +156,8 @@ def path(value, relativeto='', normalize='true', mustexist='false'):
if boolean(mustexist):
try:
- open(value, 'r')
+ with open(value, 'r'):
+ pass
except IOError as exc:
if exc.errno == errno.ENOENT:
raise ValueError("{0}: {1}".format(value, os.strerror(errno.ENOENT)))
--
2.16.4
next prev parent reply other threads:[~2019-12-10 18:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-10 18:34 [PATCH 0/6] OE alignments, including patch.bbclass Jan Kiszka
2019-12-10 18:34 ` [PATCH 1/6] lib/oe/path.py: Add GPLv2 header Jan Kiszka
2019-12-10 18:34 ` [PATCH 2/6] oe/path.py: copyhardlinktree: don't overwrite existing symlinks Jan Kiszka
2019-12-10 18:34 ` [PATCH 3/6] lib/oe/path.py: Align with OE-core regarding sparseness preservation Jan Kiszka
2019-12-10 18:34 ` [PATCH 4/6] lib/oe/terminal.py: fix gnome-terminal start behavior Jan Kiszka
2019-12-10 18:34 ` Jan Kiszka [this message]
2019-12-10 18:34 ` [PATCH 6/6] patch: Replace custom implementation with OE-core solution Jan Kiszka
2019-12-11 14:16 ` Jan Kiszka
2019-12-11 14:21 ` Baurzhan Ismagulov
2019-12-11 14:26 ` Jan Kiszka
2019-12-27 12:50 ` [PATCH 0/6] OE alignments, including patch.bbclass Baurzhan Ismagulov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5c06e579d1f5e9148920c4241d6ca3b94fc2d6be.1576002865.git.jan.kiszka@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox