From e83d8e58a6b107eea87df0ec233a1bc932b2c6ea Mon Sep 17 00:00:00 2001 From: Robert Yang Date: Tue, 29 May 2012 22:53:08 +0800 Subject: meta: replace os.popen with subprocess.Popen Replace os.popen with subprocess.Popen since the older function would fail (more or less) silently if the executed program cannot be found There are both bb.process.run() and bb.process.Popen() which wraps the subprocess module, use it for simplifying the code. Note: We don't need the "2>/dev/null" or "2>&1" since bb.process.run() can handle it, it will raise exception when error occurs, we should handle the exception ourselves if we want to ignore the error. More info: http://docs.python.org/library/subprocess.html#subprocess-replacements [YOCTO #2454] Signed-off-by: Robert Yang Signed-off-by: Richard Purdie --- meta/classes/kernel.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'meta/classes/kernel.bbclass') diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass index 116e10b9de..d74361bf93 100644 --- a/meta/classes/kernel.bbclass +++ b/meta/classes/kernel.bbclass @@ -349,7 +349,7 @@ python populate_packages_prepend () { path = d.getVar("PATH", True) cmd = "PATH=\"%s\" depmod -n -a -b %s -F %s/boot/System.map-%s %s" % (path, dvar, dvar, kernelver, kernelver_stripped) - f = os.popen(cmd, 'r') + f = bb.process.Popen(cmd, shell=True).stdout deps = {} pattern0 = "^(.*\.k?o):..*$" -- cgit v1.2.3