diff options
Diffstat (limited to 'scripts/lib/wic')
-rw-r--r-- | scripts/lib/wic/engine.py | 36 |
1 files changed, 9 insertions, 27 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index 2dc2fd5ed4..b23dd65de2 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py | |||
@@ -236,10 +236,6 @@ class Disk: | |||
236 | self.imagepath = imagepath | 236 | self.imagepath = imagepath |
237 | self.native_sysroot = native_sysroot | 237 | self.native_sysroot = native_sysroot |
238 | self._partitions = None | 238 | self._partitions = None |
239 | self._mdir = None | ||
240 | self._mcopy = None | ||
241 | self._mdel = None | ||
242 | self._mdeltree = None | ||
243 | self._partimages = {} | 239 | self._partimages = {} |
244 | 240 | ||
245 | # find parted | 241 | # find parted |
@@ -270,30 +266,16 @@ class Disk: | |||
270 | 266 | ||
271 | return self._partitions | 267 | return self._partitions |
272 | 268 | ||
273 | def _prop(self, name): | 269 | def __getattr__(self, name): |
274 | """Get path to the executable in a lazy way.""" | 270 | """Get path to the executable in a lazy way.""" |
275 | aname = "_%s" % name | 271 | if name in ("mdir", "mcopy", "mdel", "mdeltree"): |
276 | if getattr(self, aname) is None: | 272 | aname = "_%s" % name |
277 | setattr(self, aname, find_executable(name, self.paths)) | 273 | if aname not in self.__dict__: |
278 | if not getattr(self, aname): | 274 | setattr(self, aname, find_executable(name, self.paths)) |
279 | raise WicError("Can't find executable {}".format(name)) | 275 | if aname not in self.__dict__: |
280 | return getattr(self, aname) | 276 | raise WicError("Can't find executable {}".format(name)) |
281 | 277 | return self.__dict__[aname] | |
282 | @property | 278 | return self.__dict__[name] |
283 | def mdir(self): | ||
284 | return self._prop('mdir') | ||
285 | |||
286 | @property | ||
287 | def mcopy(self): | ||
288 | return self._prop("mcopy") | ||
289 | |||
290 | @property | ||
291 | def mdel(self): | ||
292 | return self._prop("mdel") | ||
293 | |||
294 | @property | ||
295 | def mdeltree(self): | ||
296 | return self._prop("mdeltree") | ||
297 | 279 | ||
298 | def _get_part_image(self, pnum): | 280 | def _get_part_image(self, pnum): |
299 | if pnum not in self.partitions: | 281 | if pnum not in self.partitions: |