[oe-commits] [openembedded-core] 18/36: wic: add Disk._prop helper
git at git.openembedded.org
git at git.openembedded.org
Wed Jun 14 09:20:58 UTC 2017
This is an automated email from the git hooks/post-receive script.
rpurdie pushed a commit to branch master
in repository openembedded-core.
commit 4c1ded3ddbd04ad1640620ec1348831692a93dbe
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
AuthorDate: Tue Jun 13 14:22:01 2017 +0300
wic: add Disk._prop helper
Added generic helper to use in property methods to
access commands in a lazy manner.
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
scripts/lib/wic/engine.py | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index f8f2844..e3701c4 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -267,13 +267,18 @@ class Disk:
return self._partitions
+ def _prop(self, name):
+ """Get path to the executable in a lazy way."""
+ aname = "_%s" % name
+ if getattr(self, aname) is None:
+ setattr(self, aname, find_executable(name, self.paths))
+ if not getattr(self, aname):
+ raise WicError("Can't find executable {}".format(name))
+ return getattr(self, aname)
+
@property
def mdir(self):
- if self._mdir is None:
- self._mdir = find_executable("mdir", self.paths)
- if not self._mdir:
- raise WicError("Can't find executable mdir")
- return self._mdir
+ return self._prop('mdir')
def _get_part_image(self, pnum):
if pnum not in self.partitions:
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list