[OE-core] [PATCH 2/4] runqemu: use glob rather than calling out to ls
Joshua Lock
joshuagloe at gmail.com
Mon Sep 5 13:59:10 UTC 2016
Use the Python glob module to find files matching a pattern, rather
than calling out to ls and parsing the output.
Signed-off-by: Joshua Lock <joshua.g.lock at intel.com>
---
scripts/runqemu | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/scripts/runqemu b/scripts/runqemu
index 72c6352..1599848 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -528,11 +528,10 @@ class BaseConfig(object):
self.qemuboot = "%s/%s-%s.qemuboot.conf" % (deploy_dir_image,
self.rootfs, machine)
else:
- cmd = 'ls -t %s/*.qemuboot.conf' % deploy_dir_image
- logger.info('Running %s...' % cmd)
- qbs = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE).stdout.read().decode('utf-8')
+ import glob
+ qbs = glob.glob('%s/*.qemuboot.conf' % deploy_dir_image)
if qbs:
- self.qemuboot = qbs.split()[0]
+ self.qemuboot = qbs.split[0]
if not os.path.exists(self.qemuboot):
raise Exception("Failed to find <image>.qemuboot.conf!")
--
2.7.4
More information about the Openembedded-core
mailing list