]> code.ossystems Code Review - openembedded-core.git/commitdiff
wic/engine.py: Load paths from PATH environment variable
authorWilliam Bourque <wbourque@gmail.com>
Mon, 11 Feb 2019 20:00:48 +0000 (15:00 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 14 Feb 2019 11:20:06 +0000 (11:20 +0000)
Load self.paths from environment variable and
if it fails, fall back to hardcoded list.
This is required for users that would need to load
different e2fsprogs binaries if their system's ones
are not recent enought

Signed-off-by: William Bourque <wbourque@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/wic/engine.py

index 97f5e848cc4d58afeeed3ee4b56db5346300be0e..880e4640367ee2e8cfeae08b26769d65d81c5dea 100644 (file)
@@ -244,8 +244,13 @@ class Disk:
         self._psector_size = None
         self._ptable_format = None
 
-        # find parted
-        self.paths = "/bin:/usr/bin:/usr/sbin:/sbin/"
+        # read paths from $PATH environment variable
+        # if it fails, use hardcoded paths
+        try:
+            self.paths = os.environ['PATH']
+        except KeyError:
+            self.paths = "/bin:/usr/bin:/usr/sbin:/sbin/"
+
         if native_sysroot:
             for path in self.paths.split(':'):
                 self.paths = "%s%s:%s" % (native_sysroot, path, self.paths)