diff options
Diffstat (limited to 'scripts/lib/wic/engine.py')
-rw-r--r-- | scripts/lib/wic/engine.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index 018815b966..ce7e6c5d75 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py @@ -19,10 +19,10 @@ import os import tempfile import json import subprocess +import shutil import re from collections import namedtuple, OrderedDict -from distutils.spawn import find_executable from wic import WicError from wic.filemap import sparse_copy @@ -245,7 +245,7 @@ class Disk: for path in pathlist.split(':'): self.paths = "%s%s:%s" % (native_sysroot, path, self.paths) - self.parted = find_executable("parted", self.paths) + self.parted = shutil.which("parted", path=self.paths) if not self.parted: raise WicError("Can't find executable parted") @@ -283,7 +283,7 @@ class Disk: "resize2fs", "mkswap", "mkdosfs", "debugfs","blkid"): aname = "_%s" % name if aname not in self.__dict__: - setattr(self, aname, find_executable(name, self.paths)) + setattr(self, aname, shutil.which(name, path=self.paths)) if aname not in self.__dict__ or self.__dict__[aname] is None: raise WicError("Can't find executable '{}'".format(name)) return self.__dict__[aname] @@ -359,7 +359,7 @@ class Disk: Remove files/dirs and their contents from the partition. This only applies to ext* partition. """ - abs_path = re.sub('\/\/+', '/', path) + abs_path = re.sub(r'\/\/+', '/', path) cmd = "{} {} -wR 'rm \"{}\"'".format(self.debugfs, self._get_part_image(pnum), abs_path) |