[gnome-continuous-yocto/gnomeostree-3.28-rocko: 2887/8267] icecc.bbclass: replace os.popen with subprocess.check_output
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 2887/8267] icecc.bbclass: replace os.popen with subprocess.check_output
- Date: Sat, 16 Dec 2017 23:51:37 +0000 (UTC)
commit 35ca6add0fdf878c563fa473ac53c1c61e24e795
Author: Martin Jansa <martin jansa gmail com>
Date: Wed Oct 5 22:53:11 2016 +0200
icecc.bbclass: replace os.popen with subprocess.check_output
* otherwise there is a lot of warnings about missing close on file descriptor
(From OE-Core rev: 629ff6eb58ddad2d533cbcc8b1a4594d3c8fd441)
Signed-off-by: Martin Jansa <Martin Jansa gmail com>
Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>
meta/classes/icecc.bbclass | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/meta/classes/icecc.bbclass b/meta/classes/icecc.bbclass
index e1c06c4..a837894 100644
--- a/meta/classes/icecc.bbclass
+++ b/meta/classes/icecc.bbclass
@@ -47,7 +47,8 @@ def get_cross_kernel_cc(bb,d):
# evaluate the expression by the shell if necessary
if '`' in kernel_cc or '$(' in kernel_cc:
- kernel_cc = os.popen("echo %s" % kernel_cc).read()[:-1]
+ import subprocess
+ kernel_cc = subprocess.check_output("echo %s" % kernel_cc, shell=True).decode("utf-8")[:-1]
kernel_cc = d.expand(kernel_cc)
kernel_cc = kernel_cc.replace('ccache', '').strip()
@@ -220,9 +221,14 @@ def icecc_get_and_check_tool(bb, d, tool):
# PATH or icecc-create-env script will silently create an invalid
# compiler environment package.
t = icecc_get_tool(bb, d, tool)
- if t and os.popen("readlink -f %s" % t).read()[:-1] == get_icecc(d):
- bb.error("%s is a symlink to %s in PATH and this prevents icecc from working" % (t, get_icecc(d)))
- return ""
+ if t:
+ import subprocess
+ link_path = subprocess.check_output("readlink -f %s" % t, shell=True).decode("utf-8")[:-1]
+ if link_path == get_icecc(d):
+ bb.error("%s is a symlink to %s in PATH and this prevents icecc from working" % (t,
get_icecc(d)))
+ return ""
+ else:
+ return t
else:
return t
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]