We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[bug] New warning in python 3.8 makes some tests fail (line buffering isn't supported in binary mode)
<!--
  Please don't forget to update the issue title.
  Include all applicable information to help us reproduce your problem.

  To help us debug your issue please explain:
-->

### Environment Details (include every applicable attribute)
  * Operating System+version: Arch Linux
  * Compiler+version: -
  * Conan version: develop
  * Python version: python 3.8

### Steps to reproduce (Include if Applicable)

Run some unit tests, for example:

```
nosetests conans.test.functional.settings
```

### Logs (Executed commands with output) (Include/Attach if Applicable)

```
$ nosetests conans.test.functional.settings
............F............F.F.............
======================================================================
FAIL: test_only_cppstd (conan.conans.test.functional.settings.cppstd.compiler_cppstd_test.UseCompilerCppStdSettingTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/siu/src/extern/conan/conans/test/functional/settings/cppstd/compiler_cppstd_test.py", line 140, in test_only_cppstd
    self.t.run("info . -s cppstd=14")
  File "/usr/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/home/siu/src/extern/conan/conans/test/utils/deprecation.py", line 13, in catch_deprecation_warning
    test_suite.assertEqual(len(w), n)
AssertionError: 2 != 1

======================================================================
FAIL: gcc_8_std_20_test (conan.conans.test.functional.settings.cppstd_test.StdCppTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/siu/src/extern/conan/conans/test/functional/settings/cppstd_test.py", line 47, in gcc_8_std_20_test
    client.run('create . user/testing -s compiler="gcc" '
  File "/usr/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/home/siu/src/extern/conan/conans/test/utils/deprecation.py", line 13, in catch_deprecation_warning
    test_suite.assertEqual(len(w), n)
AssertionError: 2 != 1

======================================================================
FAIL: use_wrong_setting_for_compiler_test (conan.conans.test.functional.settings.cppstd_test.StdCppTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/siu/src/extern/conan/conans/test/functional/settings/cppstd_test.py", line 23, in use_wrong_setting_for_compiler_test
    client.run('create . user/testing -s compiler="gcc" '
  File "/usr/lib/python3.8/contextlib.py", line 120, in __exit__
    next(self.gen)
  File "/home/siu/src/extern/conan/conans/test/utils/deprecation.py", line 13, in catch_deprecation_warning
    test_suite.assertEqual(len(w), n)
AssertionError: 2 != 1

----------------------------------------------------------------------
Ran 41 tests in 4.690s

FAILED (failures=3)
```

<!--
  Your log content should be related to the bug description, it can be:
  - Conan command output
  - Server output (Artifactory, conan_server)
-->


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `conans/client/conf/detect.py`
Content:
```
1 import os
2 import platform
3 import re
4 from subprocess import PIPE, Popen, STDOUT
5 
6 from conans.client.output import Color
7 from conans.client.tools import detected_os, OSInfo
8 from conans.client.tools.win import latest_visual_studio_version_installed
9 from conans.model.version import Version
10 
11 
12 def _execute(command):
13     proc = Popen(command, shell=True, bufsize=1, stdout=PIPE, stderr=STDOUT)
14 
15     output_buffer = []
16     while True:
17         line = proc.stdout.readline()
18         if not line:
19             break
20         # output.write(line)
21         output_buffer.append(str(line))
22 
23     proc.communicate()
24     return proc.returncode, "".join(output_buffer)
25 
26 
27 def _gcc_compiler(output, compiler_exe="gcc"):
28 
29     try:
30         if platform.system() == "Darwin":
31             # In Mac OS X check if gcc is a fronted using apple-clang
32             _, out = _execute("%s --version" % compiler_exe)
33             out = out.lower()
34             if "clang" in out:
35                 return None
36 
37         ret, out = _execute('%s -dumpversion' % compiler_exe)
38         if ret != 0:
39             return None
40         compiler = "gcc"
41         installed_version = re.search("([0-9](\.[0-9])?)", out).group()
42         # Since GCC 7.1, -dumpversion return the major version number
43         # only ("7"). We must use -dumpfullversion to get the full version
44         # number ("7.1.1").
45         if installed_version:
46             output.success("Found %s %s" % (compiler, installed_version))
47             return compiler, installed_version
48     except Exception:
49         return None
50 
51 
52 def _clang_compiler(output, compiler_exe="clang"):
53     try:
54         ret, out = _execute('%s --version' % compiler_exe)
55         if ret != 0:
56             return None
57         if "Apple" in out:
58             compiler = "apple-clang"
59         elif "clang version" in out:
60             compiler = "clang"
61         installed_version = re.search("([0-9]+\.[0-9])", out).group()
62         if installed_version:
63             output.success("Found %s %s" % (compiler, installed_version))
64             return compiler, installed_version
65     except Exception:
66         return None
67 
68 
69 def _sun_cc_compiler(output, compiler_exe="cc"):
70     try:
71         _, out = _execute('%s -V' % compiler_exe)
72         compiler = "sun-cc"
73         installed_version = re.search("([0-9]+\.[0-9]+)", out).group()
74         if installed_version:
75             output.success("Found %s %s" % (compiler, installed_version))
76             return compiler, installed_version
77     except Exception:
78         return None
79 
80 
81 def _get_default_compiler(output):
82     cc = os.environ.get("CC", "")
83     cxx = os.environ.get("CXX", "")
84     if cc or cxx:  # Env defined, use them
85         output.info("CC and CXX: %s, %s " % (cc or "None", cxx or "None"))
86         command = cc or cxx
87         if "gcc" in command:
88             gcc = _gcc_compiler(output, command)
89             if platform.system() == "Darwin" and gcc is None:
90                 output.error(
91                     "%s detected as a frontend using apple-clang. Compiler not supported" % command
92                 )
93             return gcc
94         if "clang" in command.lower():
95             return _clang_compiler(output, command)
96         if platform.system() == "SunOS" and command.lower() == "cc":
97             return _sun_cc_compiler(output, command)
98         # I am not able to find its version
99         output.error("Not able to automatically detect '%s' version" % command)
100         return None
101 
102     if detected_os() == "Windows":
103         version = latest_visual_studio_version_installed(output)
104         vs = ('Visual Studio', version) if version else None
105     gcc = _gcc_compiler(output)
106     clang = _clang_compiler(output)
107     if platform.system() == "SunOS":
108         sun_cc = _sun_cc_compiler(output)
109 
110     if detected_os() == "Windows":
111         return vs or gcc or clang
112     elif platform.system() == "Darwin":
113         return clang or gcc
114     elif platform.system() == "SunOS":
115         return sun_cc or gcc or clang
116     else:
117         return gcc or clang
118 
119 
120 def _get_profile_compiler_version(compiler, version, output):
121     major = version.split(".")[0]
122     if compiler == "clang" and int(major) >= 8:
123         output.info("clang>=8, using the major as version")
124         return major
125     elif compiler == "gcc" and int(major) >= 5:
126         output.info("gcc>=5, using the major as version")
127         return major
128     return version
129 
130 
131 def _detect_compiler_version(result, output, profile_path):
132     try:
133         compiler, version = _get_default_compiler(output)
134     except Exception:
135         compiler, version = None, None
136     if not compiler or not version:
137         output.error("Unable to find a working compiler")
138     else:
139         result.append(("compiler", compiler))
140         result.append(("compiler.version",
141                        _get_profile_compiler_version(compiler, version, output)))
142         if compiler == "apple-clang":
143             result.append(("compiler.libcxx", "libc++"))
144         elif compiler == "gcc":
145             result.append(("compiler.libcxx", "libstdc++"))
146             if Version(version) >= Version("5.1"):
147                 profile_name = os.path.basename(profile_path)
148                 msg = """
149 Conan detected a GCC version > 5 but has adjusted the 'compiler.libcxx' setting to
150 'libstdc++' for backwards compatibility.
151 Your compiler is likely using the new CXX11 ABI by default (libstdc++11).
152 
153 If you want Conan to use the new ABI for the {profile} profile, run:
154 
155     $ conan profile update settings.compiler.libcxx=libstdc++11 {profile}
156 
157 Or edit '{profile_path}' and set compiler.libcxx=libstdc++11
158 """.format(profile=profile_name, profile_path=profile_path)
159                 output.writeln("\n************************* WARNING: GCC OLD ABI COMPATIBILITY "
160                                "***********************\n %s\n************************************"
161                                "************************************************\n\n\n" % msg,
162                                Color.BRIGHT_RED)
163         elif compiler == "cc":
164             if platform.system() == "SunOS":
165                 result.append(("compiler.libstdcxx", "libstdcxx4"))
166         elif compiler == "clang":
167             if platform.system() == "FreeBSD":
168                 result.append(("compiler.libcxx", "libc++"))
169             else:
170                 result.append(("compiler.libcxx", "libstdc++"))
171         elif compiler == "sun-cc":
172             result.append(("compiler.libcxx", "libCstd"))
173 
174 
175 def _detect_os_arch(result, output):
176     architectures = {'i386': 'x86',
177                      'i686': 'x86',
178                      'i86pc': 'x86',
179                      'amd64': 'x86_64',
180                      'aarch64': 'armv8',
181                      'sun4v': 'sparc'}
182     the_os = detected_os()
183     result.append(("os", the_os))
184     result.append(("os_build", the_os))
185 
186     platform_machine = platform.machine().lower()
187     if platform_machine:
188         arch = architectures.get(platform_machine, platform_machine)
189         if arch.startswith('arm'):
190             for a in ("armv6", "armv7hf", "armv7", "armv8"):
191                 if arch.startswith(a):
192                     arch = a
193                     break
194             else:
195                 output.error("Your ARM '%s' architecture is probably not defined in settings.yml\n"
196                              "Please check your conan.conf and settings.yml files" % arch)
197         elif OSInfo().is_aix:
198             arch = OSInfo.get_aix_architecture() or arch
199 
200         result.append(("arch", arch))
201         result.append(("arch_build", arch))
202 
203 
204 def detect_defaults_settings(output, profile_path):
205     """ try to deduce current machine values without any constraints at all
206     :param output: Conan Output instance
207     :param profile_path: Conan profile file path
208     :return: A list with default settings
209     """
210     result = []
211     _detect_os_arch(result, output)
212     _detect_compiler_version(result, output, profile_path)
213     result.append(("build_type", "Release"))
214 
215     return result
216
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/conans/client/conf/detect.py b/conans/client/conf/detect.py
--- a/conans/client/conf/detect.py
+++ b/conans/client/conf/detect.py
@@ -10,7 +10,8 @@
 
 
 def _execute(command):
-    proc = Popen(command, shell=True, bufsize=1, stdout=PIPE, stderr=STDOUT)
+    proc = Popen(command, shell=True, bufsize=1, universal_newlines=True, stdout=PIPE,
+                 stderr=STDOUT)
 
     output_buffer = []
     while True:

{"golden_diff": "diff --git a/conans/client/conf/detect.py b/conans/client/conf/detect.py\n--- a/conans/client/conf/detect.py\n+++ b/conans/client/conf/detect.py\n@@ -10,7 +10,8 @@\n \n \n def _execute(command):\n-    proc = Popen(command, shell=True, bufsize=1, stdout=PIPE, stderr=STDOUT)\n+    proc = Popen(command, shell=True, bufsize=1, universal_newlines=True, stdout=PIPE,\n+                 stderr=STDOUT)\n \n     output_buffer = []\n     while True:\n", "issue": "[bug] New warning in python 3.8 makes some tests fail (line buffering isn't supported in binary mode)\n<!--\r\n  Please don't forget to update the issue title.\r\n  Include all applicable information to help us reproduce your problem.\r\n\r\n  To help us debug your issue please explain:\r\n-->\r\n\r\n### Environment Details (include every applicable attribute)\r\n  * Operating System+version: Arch Linux\r\n  * Compiler+version: -\r\n  * Conan version: develop\r\n  * Python version: python 3.8\r\n\r\n### Steps to reproduce (Include if Applicable)\r\n\r\nRun some unit tests, for example:\r\n\r\n```\r\nnosetests conans.test.functional.settings\r\n```\r\n\r\n### Logs (Executed commands with output) (Include/Attach if Applicable)\r\n\r\n```\r\n$ nosetests conans.test.functional.settings\r\n............F............F.F.............\r\n======================================================================\r\nFAIL: test_only_cppstd (conan.conans.test.functional.settings.cppstd.compiler_cppstd_test.UseCompilerCppStdSettingTests)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/home/siu/src/extern/conan/conans/test/functional/settings/cppstd/compiler_cppstd_test.py\", line 140, in test_only_cppstd\r\n    self.t.run(\"info . -s cppstd=14\")\r\n  File \"/usr/lib/python3.8/contextlib.py\", line 120, in __exit__\r\n    next(self.gen)\r\n  File \"/home/siu/src/extern/conan/conans/test/utils/deprecation.py\", line 13, in catch_deprecation_warning\r\n    test_suite.assertEqual(len(w), n)\r\nAssertionError: 2 != 1\r\n\r\n======================================================================\r\nFAIL: gcc_8_std_20_test (conan.conans.test.functional.settings.cppstd_test.StdCppTest)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/home/siu/src/extern/conan/conans/test/functional/settings/cppstd_test.py\", line 47, in gcc_8_std_20_test\r\n    client.run('create . user/testing -s compiler=\"gcc\" '\r\n  File \"/usr/lib/python3.8/contextlib.py\", line 120, in __exit__\r\n    next(self.gen)\r\n  File \"/home/siu/src/extern/conan/conans/test/utils/deprecation.py\", line 13, in catch_deprecation_warning\r\n    test_suite.assertEqual(len(w), n)\r\nAssertionError: 2 != 1\r\n\r\n======================================================================\r\nFAIL: use_wrong_setting_for_compiler_test (conan.conans.test.functional.settings.cppstd_test.StdCppTest)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/home/siu/src/extern/conan/conans/test/functional/settings/cppstd_test.py\", line 23, in use_wrong_setting_for_compiler_test\r\n    client.run('create . user/testing -s compiler=\"gcc\" '\r\n  File \"/usr/lib/python3.8/contextlib.py\", line 120, in __exit__\r\n    next(self.gen)\r\n  File \"/home/siu/src/extern/conan/conans/test/utils/deprecation.py\", line 13, in catch_deprecation_warning\r\n    test_suite.assertEqual(len(w), n)\r\nAssertionError: 2 != 1\r\n\r\n----------------------------------------------------------------------\r\nRan 41 tests in 4.690s\r\n\r\nFAILED (failures=3)\r\n```\r\n\r\n<!--\r\n  Your log content should be related to the bug description, it can be:\r\n  - Conan command output\r\n  - Server output (Artifactory, conan_server)\r\n-->\r\n\n", "before_files": [{"content": "import os\nimport platform\nimport re\nfrom subprocess import PIPE, Popen, STDOUT\n\nfrom conans.client.output import Color\nfrom conans.client.tools import detected_os, OSInfo\nfrom conans.client.tools.win import latest_visual_studio_version_installed\nfrom conans.model.version import Version\n\n\ndef _execute(command):\n    proc = Popen(command, shell=True, bufsize=1, stdout=PIPE, stderr=STDOUT)\n\n    output_buffer = []\n    while True:\n        line = proc.stdout.readline()\n        if not line:\n            break\n        # output.write(line)\n        output_buffer.append(str(line))\n\n    proc.communicate()\n    return proc.returncode, \"\".join(output_buffer)\n\n\ndef _gcc_compiler(output, compiler_exe=\"gcc\"):\n\n    try:\n        if platform.system() == \"Darwin\":\n            # In Mac OS X check if gcc is a fronted using apple-clang\n            _, out = _execute(\"%s --version\" % compiler_exe)\n            out = out.lower()\n            if \"clang\" in out:\n                return None\n\n        ret, out = _execute('%s -dumpversion' % compiler_exe)\n        if ret != 0:\n            return None\n        compiler = \"gcc\"\n        installed_version = re.search(\"([0-9](\\.[0-9])?)\", out).group()\n        # Since GCC 7.1, -dumpversion return the major version number\n        # only (\"7\"). We must use -dumpfullversion to get the full version\n        # number (\"7.1.1\").\n        if installed_version:\n            output.success(\"Found %s %s\" % (compiler, installed_version))\n            return compiler, installed_version\n    except Exception:\n        return None\n\n\ndef _clang_compiler(output, compiler_exe=\"clang\"):\n    try:\n        ret, out = _execute('%s --version' % compiler_exe)\n        if ret != 0:\n            return None\n        if \"Apple\" in out:\n            compiler = \"apple-clang\"\n        elif \"clang version\" in out:\n            compiler = \"clang\"\n        installed_version = re.search(\"([0-9]+\\.[0-9])\", out).group()\n        if installed_version:\n            output.success(\"Found %s %s\" % (compiler, installed_version))\n            return compiler, installed_version\n    except Exception:\n        return None\n\n\ndef _sun_cc_compiler(output, compiler_exe=\"cc\"):\n    try:\n        _, out = _execute('%s -V' % compiler_exe)\n        compiler = \"sun-cc\"\n        installed_version = re.search(\"([0-9]+\\.[0-9]+)\", out).group()\n        if installed_version:\n            output.success(\"Found %s %s\" % (compiler, installed_version))\n            return compiler, installed_version\n    except Exception:\n        return None\n\n\ndef _get_default_compiler(output):\n    cc = os.environ.get(\"CC\", \"\")\n    cxx = os.environ.get(\"CXX\", \"\")\n    if cc or cxx:  # Env defined, use them\n        output.info(\"CC and CXX: %s, %s \" % (cc or \"None\", cxx or \"None\"))\n        command = cc or cxx\n        if \"gcc\" in command:\n            gcc = _gcc_compiler(output, command)\n            if platform.system() == \"Darwin\" and gcc is None:\n                output.error(\n                    \"%s detected as a frontend using apple-clang. Compiler not supported\" % command\n                )\n            return gcc\n        if \"clang\" in command.lower():\n            return _clang_compiler(output, command)\n        if platform.system() == \"SunOS\" and command.lower() == \"cc\":\n            return _sun_cc_compiler(output, command)\n        # I am not able to find its version\n        output.error(\"Not able to automatically detect '%s' version\" % command)\n        return None\n\n    if detected_os() == \"Windows\":\n        version = latest_visual_studio_version_installed(output)\n        vs = ('Visual Studio', version) if version else None\n    gcc = _gcc_compiler(output)\n    clang = _clang_compiler(output)\n    if platform.system() == \"SunOS\":\n        sun_cc = _sun_cc_compiler(output)\n\n    if detected_os() == \"Windows\":\n        return vs or gcc or clang\n    elif platform.system() == \"Darwin\":\n        return clang or gcc\n    elif platform.system() == \"SunOS\":\n        return sun_cc or gcc or clang\n    else:\n        return gcc or clang\n\n\ndef _get_profile_compiler_version(compiler, version, output):\n    major = version.split(\".\")[0]\n    if compiler == \"clang\" and int(major) >= 8:\n        output.info(\"clang>=8, using the major as version\")\n        return major\n    elif compiler == \"gcc\" and int(major) >= 5:\n        output.info(\"gcc>=5, using the major as version\")\n        return major\n    return version\n\n\ndef _detect_compiler_version(result, output, profile_path):\n    try:\n        compiler, version = _get_default_compiler(output)\n    except Exception:\n        compiler, version = None, None\n    if not compiler or not version:\n        output.error(\"Unable to find a working compiler\")\n    else:\n        result.append((\"compiler\", compiler))\n        result.append((\"compiler.version\",\n                       _get_profile_compiler_version(compiler, version, output)))\n        if compiler == \"apple-clang\":\n            result.append((\"compiler.libcxx\", \"libc++\"))\n        elif compiler == \"gcc\":\n            result.append((\"compiler.libcxx\", \"libstdc++\"))\n            if Version(version) >= Version(\"5.1\"):\n                profile_name = os.path.basename(profile_path)\n                msg = \"\"\"\nConan detected a GCC version > 5 but has adjusted the 'compiler.libcxx' setting to\n'libstdc++' for backwards compatibility.\nYour compiler is likely using the new CXX11 ABI by default (libstdc++11).\n\nIf you want Conan to use the new ABI for the {profile} profile, run:\n\n    $ conan profile update settings.compiler.libcxx=libstdc++11 {profile}\n\nOr edit '{profile_path}' and set compiler.libcxx=libstdc++11\n\"\"\".format(profile=profile_name, profile_path=profile_path)\n                output.writeln(\"\\n************************* WARNING: GCC OLD ABI COMPATIBILITY \"\n                               \"***********************\\n %s\\n************************************\"\n                               \"************************************************\\n\\n\\n\" % msg,\n                               Color.BRIGHT_RED)\n        elif compiler == \"cc\":\n            if platform.system() == \"SunOS\":\n                result.append((\"compiler.libstdcxx\", \"libstdcxx4\"))\n        elif compiler == \"clang\":\n            if platform.system() == \"FreeBSD\":\n                result.append((\"compiler.libcxx\", \"libc++\"))\n            else:\n                result.append((\"compiler.libcxx\", \"libstdc++\"))\n        elif compiler == \"sun-cc\":\n            result.append((\"compiler.libcxx\", \"libCstd\"))\n\n\ndef _detect_os_arch(result, output):\n    architectures = {'i386': 'x86',\n                     'i686': 'x86',\n                     'i86pc': 'x86',\n                     'amd64': 'x86_64',\n                     'aarch64': 'armv8',\n                     'sun4v': 'sparc'}\n    the_os = detected_os()\n    result.append((\"os\", the_os))\n    result.append((\"os_build\", the_os))\n\n    platform_machine = platform.machine().lower()\n    if platform_machine:\n        arch = architectures.get(platform_machine, platform_machine)\n        if arch.startswith('arm'):\n            for a in (\"armv6\", \"armv7hf\", \"armv7\", \"armv8\"):\n                if arch.startswith(a):\n                    arch = a\n                    break\n            else:\n                output.error(\"Your ARM '%s' architecture is probably not defined in settings.yml\\n\"\n                             \"Please check your conan.conf and settings.yml files\" % arch)\n        elif OSInfo().is_aix:\n            arch = OSInfo.get_aix_architecture() or arch\n\n        result.append((\"arch\", arch))\n        result.append((\"arch_build\", arch))\n\n\ndef detect_defaults_settings(output, profile_path):\n    \"\"\" try to deduce current machine values without any constraints at all\n    :param output: Conan Output instance\n    :param profile_path: Conan profile file path\n    :return: A list with default settings\n    \"\"\"\n    result = []\n    _detect_os_arch(result, output)\n    _detect_compiler_version(result, output, profile_path)\n    result.append((\"build_type\", \"Release\"))\n\n    return result\n", "path": "conans/client/conf/detect.py"}], "after_files": [{"content": "import os\nimport platform\nimport re\nfrom subprocess import PIPE, Popen, STDOUT\n\nfrom conans.client.output import Color\nfrom conans.client.tools import detected_os, OSInfo\nfrom conans.client.tools.win import latest_visual_studio_version_installed\nfrom conans.model.version import Version\n\n\ndef _execute(command):\n    proc = Popen(command, shell=True, bufsize=1, universal_newlines=True, stdout=PIPE,\n                 stderr=STDOUT)\n\n    output_buffer = []\n    while True:\n        line = proc.stdout.readline()\n        if not line:\n            break\n        # output.write(line)\n        output_buffer.append(str(line))\n\n    proc.communicate()\n    return proc.returncode, \"\".join(output_buffer)\n\n\ndef _gcc_compiler(output, compiler_exe=\"gcc\"):\n\n    try:\n        if platform.system() == \"Darwin\":\n            # In Mac OS X check if gcc is a fronted using apple-clang\n            _, out = _execute(\"%s --version\" % compiler_exe)\n            out = out.lower()\n            if \"clang\" in out:\n                return None\n\n        ret, out = _execute('%s -dumpversion' % compiler_exe)\n        if ret != 0:\n            return None\n        compiler = \"gcc\"\n        installed_version = re.search(\"([0-9](\\.[0-9])?)\", out).group()\n        # Since GCC 7.1, -dumpversion return the major version number\n        # only (\"7\"). We must use -dumpfullversion to get the full version\n        # number (\"7.1.1\").\n        if installed_version:\n            output.success(\"Found %s %s\" % (compiler, installed_version))\n            return compiler, installed_version\n    except Exception:\n        return None\n\n\ndef _clang_compiler(output, compiler_exe=\"clang\"):\n    try:\n        ret, out = _execute('%s --version' % compiler_exe)\n        if ret != 0:\n            return None\n        if \"Apple\" in out:\n            compiler = \"apple-clang\"\n        elif \"clang version\" in out:\n            compiler = \"clang\"\n        installed_version = re.search(\"([0-9]+\\.[0-9])\", out).group()\n        if installed_version:\n            output.success(\"Found %s %s\" % (compiler, installed_version))\n            return compiler, installed_version\n    except Exception:\n        return None\n\n\ndef _sun_cc_compiler(output, compiler_exe=\"cc\"):\n    try:\n        _, out = _execute('%s -V' % compiler_exe)\n        compiler = \"sun-cc\"\n        installed_version = re.search(\"([0-9]+\\.[0-9]+)\", out).group()\n        if installed_version:\n            output.success(\"Found %s %s\" % (compiler, installed_version))\n            return compiler, installed_version\n    except Exception:\n        return None\n\n\ndef _get_default_compiler(output):\n    cc = os.environ.get(\"CC\", \"\")\n    cxx = os.environ.get(\"CXX\", \"\")\n    if cc or cxx:  # Env defined, use them\n        output.info(\"CC and CXX: %s, %s \" % (cc or \"None\", cxx or \"None\"))\n        command = cc or cxx\n        if \"gcc\" in command:\n            gcc = _gcc_compiler(output, command)\n            if platform.system() == \"Darwin\" and gcc is None:\n                output.error(\n                    \"%s detected as a frontend using apple-clang. Compiler not supported\" % command\n                )\n            return gcc\n        if \"clang\" in command.lower():\n            return _clang_compiler(output, command)\n        if platform.system() == \"SunOS\" and command.lower() == \"cc\":\n            return _sun_cc_compiler(output, command)\n        # I am not able to find its version\n        output.error(\"Not able to automatically detect '%s' version\" % command)\n        return None\n\n    if detected_os() == \"Windows\":\n        version = latest_visual_studio_version_installed(output)\n        vs = ('Visual Studio', version) if version else None\n    gcc = _gcc_compiler(output)\n    clang = _clang_compiler(output)\n    if platform.system() == \"SunOS\":\n        sun_cc = _sun_cc_compiler(output)\n\n    if detected_os() == \"Windows\":\n        return vs or gcc or clang\n    elif platform.system() == \"Darwin\":\n        return clang or gcc\n    elif platform.system() == \"SunOS\":\n        return sun_cc or gcc or clang\n    else:\n        return gcc or clang\n\n\ndef _get_profile_compiler_version(compiler, version, output):\n    major = version.split(\".\")[0]\n    if compiler == \"clang\" and int(major) >= 8:\n        output.info(\"clang>=8, using the major as version\")\n        return major\n    elif compiler == \"gcc\" and int(major) >= 5:\n        output.info(\"gcc>=5, using the major as version\")\n        return major\n    return version\n\n\ndef _detect_compiler_version(result, output, profile_path):\n    try:\n        compiler, version = _get_default_compiler(output)\n    except Exception:\n        compiler, version = None, None\n    if not compiler or not version:\n        output.error(\"Unable to find a working compiler\")\n    else:\n        result.append((\"compiler\", compiler))\n        result.append((\"compiler.version\",\n                       _get_profile_compiler_version(compiler, version, output)))\n        if compiler == \"apple-clang\":\n            result.append((\"compiler.libcxx\", \"libc++\"))\n        elif compiler == \"gcc\":\n            result.append((\"compiler.libcxx\", \"libstdc++\"))\n            if Version(version) >= Version(\"5.1\"):\n                profile_name = os.path.basename(profile_path)\n                msg = \"\"\"\nConan detected a GCC version > 5 but has adjusted the 'compiler.libcxx' setting to\n'libstdc++' for backwards compatibility.\nYour compiler is likely using the new CXX11 ABI by default (libstdc++11).\n\nIf you want Conan to use the new ABI for the {profile} profile, run:\n\n    $ conan profile update settings.compiler.libcxx=libstdc++11 {profile}\n\nOr edit '{profile_path}' and set compiler.libcxx=libstdc++11\n\"\"\".format(profile=profile_name, profile_path=profile_path)\n                output.writeln(\"\\n************************* WARNING: GCC OLD ABI COMPATIBILITY \"\n                               \"***********************\\n %s\\n************************************\"\n                               \"************************************************\\n\\n\\n\" % msg,\n                               Color.BRIGHT_RED)\n        elif compiler == \"cc\":\n            if platform.system() == \"SunOS\":\n                result.append((\"compiler.libstdcxx\", \"libstdcxx4\"))\n        elif compiler == \"clang\":\n            if platform.system() == \"FreeBSD\":\n                result.append((\"compiler.libcxx\", \"libc++\"))\n            else:\n                result.append((\"compiler.libcxx\", \"libstdc++\"))\n        elif compiler == \"sun-cc\":\n            result.append((\"compiler.libcxx\", \"libCstd\"))\n\n\ndef _detect_os_arch(result, output):\n    architectures = {'i386': 'x86',\n                     'i686': 'x86',\n                     'i86pc': 'x86',\n                     'amd64': 'x86_64',\n                     'aarch64': 'armv8',\n                     'sun4v': 'sparc'}\n    the_os = detected_os()\n    result.append((\"os\", the_os))\n    result.append((\"os_build\", the_os))\n\n    platform_machine = platform.machine().lower()\n    if platform_machine:\n        arch = architectures.get(platform_machine, platform_machine)\n        if arch.startswith('arm'):\n            for a in (\"armv6\", \"armv7hf\", \"armv7\", \"armv8\"):\n                if arch.startswith(a):\n                    arch = a\n                    break\n            else:\n                output.error(\"Your ARM '%s' architecture is probably not defined in settings.yml\\n\"\n                             \"Please check your conan.conf and settings.yml files\" % arch)\n        elif OSInfo().is_aix:\n            arch = OSInfo.get_aix_architecture() or arch\n\n        result.append((\"arch\", arch))\n        result.append((\"arch_build\", arch))\n\n\ndef detect_defaults_settings(output, profile_path):\n    \"\"\" try to deduce current machine values without any constraints at all\n    :param output: Conan Output instance\n    :param profile_path: Conan profile file path\n    :return: A list with default settings\n    \"\"\"\n    result = []\n    _detect_os_arch(result, output)\n    _detect_compiler_version(result, output, profile_path)\n    result.append((\"build_type\", \"Release\"))\n\n    return result\n", "path": "conans/client/conf/detect.py"}]}