commit:     b4acbf4935bfa8162304444fde8448629ac4a839
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 31 12:22:42 2022 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jul 31 12:22:42 2022 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b4acbf49

lib/_emerge/actions.py: drop custom clang identification

drop this bit, because:
- there are no native Clang toolchains in use in Prefix currently
- it isn't guaranteed to be correct
- we can just rely on PATH because this isn't anything but cosmetics
- it is cosmetics, it isn't necessary for Prefix to operate correctly
- it is disputed to be correct in the first place:
  https://github.com/gentoo/portage/pull/876

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 lib/_emerge/actions.py | 40 ++--------------------------------------
 1 file changed, 2 insertions(+), 38 deletions(-)

diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py
index bf00133e8..e2f3f2ccf 100644
--- a/lib/_emerge/actions.py
+++ b/lib/_emerge/actions.py
@@ -36,7 +36,6 @@ from portage import shutil
 from portage import _encodings, _unicode_decode
 from portage.binrepo.config import BinRepoConfigLoader
 from portage.const import BINREPOS_CONF_FILE, _DEPCLEAN_LIB_CHECK_DEFAULT
-from portage.const import EPREFIX
 from portage.dbapi.dep_expand import dep_expand
 from portage.dbapi._expand_new_virt import expand_new_virt
 from portage.dbapi.IndexedPortdb import IndexedPortdb
@@ -2951,19 +2950,6 @@ def getgccversion(chost=None):
     gcc_ver_command = ["gcc", "-dumpversion"]
     gcc_ver_prefix = "gcc-"
 
-    # BEGIN PREFIX LOCAL: accept clang as system compiler too
-    clang_ver_command = ['clang', '--version']
-    clang_ver_prefix = 'clang-'
-
-    ubinpath = os.path.join('/', portage.const.EPREFIX, 'usr', 'bin')
-
-    def getclangversion(output):
-        version = re.search('clang version ([0-9.]+) ', output)
-        if version:
-            return version.group(1)
-        return "unknown"
-    # END PREFIX LOCAL
-
     gcc_not_found_error = red(
         "!!! No gcc found. You probably need to 'source /etc/profile'\n"
         + "!!! to update the environment of this terminal and possibly\n"
@@ -2972,10 +2958,8 @@ def getgccversion(chost=None):
 
     if chost:
         try:
-            # PREFIX LOCAL: use ubinpath
             proc = subprocess.Popen(
-                [ubinpath + "/" + "gcc-config", "-c"],
-                stdout=subprocess.PIPE, stderr=subprocess.STDOUT
+                ["gcc-config", "-c"], stdout=subprocess.PIPE, 
stderr=subprocess.STDOUT
             )
         except OSError:
             myoutput = None
@@ -2987,10 +2971,8 @@ def getgccversion(chost=None):
             return myoutput.replace(chost + "-", gcc_ver_prefix, 1)
 
         try:
-            # PREFIX LOCAL: use ubinpath
             proc = subprocess.Popen(
-                [ubinpath + "/" + chost + "-" + gcc_ver_command[0]]
-                + gcc_ver_command[1:],
+                [chost + "-" + gcc_ver_command[0]] + gcc_ver_command[1:],
                 stdout=subprocess.PIPE,
                 stderr=subprocess.STDOUT,
             )
@@ -3003,24 +2985,6 @@ def getgccversion(chost=None):
         if mystatus == os.EX_OK:
             return gcc_ver_prefix + myoutput
 
-        # BEGIN PREFIX LOCAL: try Clang
-        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)
-        # END PREFIX LOCAL
-
     try:
         proc = subprocess.Popen(
             gcc_ver_command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT

Reply via email to