mirror of
https://git.yoctoproject.org/poky
synced 2026-04-18 21:32:12 +02:00
wic: add Disk._prop helper
Added generic helper to use in property methods to access commands in a lazy manner. (From OE-Core rev: 4c1ded3ddbd04ad1640620ec1348831692a93dbe) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
ecefd3c55b
commit
0165f40cbb
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user