commit:     337b7fa533809196abcbf79b4a43172d595e943e
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 24 07:42:54 2017 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Mar 24 07:42:54 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=337b7fa5

getgccversion: properly guard the use of chost

 pym/_emerge/actions.py | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 704243a7e..6f9b805ef 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -2495,18 +2495,19 @@ def getgccversion(chost=None):
        if mystatus == os.EX_OK:
                return gcc_ver_prefix + myoutput
 
-       try:
-               proc = subprocess.Popen(
-                       [ubinpath + "/" + chost + "-" + clang_ver_command[0]] + 
clang_ver_command[1:],
-                       stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
-       except OSError:
-               myoutput = None
-               mystatus = 1
-       else:
-               myoutput = _unicode_decode(proc.communicate()[0]).rstrip("\n")
-               mystatus = proc.wait()
-       if mystatus == os.EX_OK:
-               return clang_ver_prefix + getclangversion(myoutput)
+       if chost:
+               try:
+                       proc = subprocess.Popen(
+                               [ubinpath + "/" + chost + "-" + 
clang_ver_command[0]] + clang_ver_command[1:],
+                               stdout=subprocess.PIPE, 
stderr=subprocess.STDOUT)
+               except OSError:
+                       myoutput = None
+                       mystatus = 1
+               else:
+                       myoutput = 
_unicode_decode(proc.communicate()[0]).rstrip("\n")
+                       mystatus = proc.wait()
+               if mystatus == os.EX_OK:
+                       return clang_ver_prefix + getclangversion(myoutput)
 
        try:
                proc = subprocess.Popen([ubinpath + "/" + clang_ver_command[0]] 
+ clang_ver_command[1:],

Reply via email to