diff options
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/wic/engine.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index f8f2844cf6..e3701c442e 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py | |||
@@ -267,13 +267,18 @@ class Disk: | |||
267 | 267 | ||
268 | return self._partitions | 268 | return self._partitions |
269 | 269 | ||
270 | def _prop(self, name): | ||
271 | """Get path to the executable in a lazy way.""" | ||
272 | aname = "_%s" % name | ||
273 | if getattr(self, aname) is None: | ||
274 | setattr(self, aname, find_executable(name, self.paths)) | ||
275 | if not getattr(self, aname): | ||
276 | raise WicError("Can't find executable {}".format(name)) | ||
277 | return getattr(self, aname) | ||
278 | |||
270 | @property | 279 | @property |
271 | def mdir(self): | 280 | def mdir(self): |
272 | if self._mdir is None: | 281 | return self._prop('mdir') |
273 | self._mdir = find_executable("mdir", self.paths) | ||
274 | if not self._mdir: | ||
275 | raise WicError("Can't find executable mdir") | ||
276 | return self._mdir | ||
277 | 282 | ||
278 | def _get_part_image(self, pnum): | 283 | def _get_part_image(self, pnum): |
279 | if pnum not in self.partitions: | 284 | if pnum not in self.partitions: |