summaryrefslogtreecommitdiff
path: root/meta/lib/oe/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'meta/lib/oe/utils.py')
-rw-r--r--meta/lib/oe/utils.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index bb3f0e5d75..bf440ec960 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -231,12 +231,16 @@ def format_pkg_list(pkg_dict, ret_format=None):
return '\n'.join(output)
def host_gcc_version(d):
+ import re, subprocess
+
compiler = d.getVar("BUILD_CC")
- retval, output = getstatusoutput("%s --version" % compiler)
- if retval:
- bb.fatal("Error running %s --version: %s" % (compiler, output))
+ try:
+ env = os.environ.copy()
+ env["PATH"] = d.getVar("PATH")
+ output = subprocess.check_output("%s --version" % compiler, shell=True, env=env).decode("utf-8")
+ except subprocess.CalledProcessError as e:
+ bb.fatal("Error running %s --version: %s" % (compiler, e.output.decode("utf-8")))
- import re
match = re.match(".* (\d\.\d)\.\d.*", output.split('\n')[0])
if not match:
bb.fatal("Can't get compiler version from %s --version output" % compiler)