nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: conan-io/conan
Pull request #12028 (2022-09-05 13:10:49)

CLICOLOR_FORCE support
Changelog: Feature: Added support for `CLICOLOR_FORCE` env var, that will activate the colors in the output if the value is declared and different to `0`.
Docs: https://github.com/conan-io/docs/pull/XXXX


Close https://github.com/conan-io/conan/issues/11892


Patch:
diff --git a/conans/client/userio.py b/conans/client/userio.py
index 137679cb9..b6a778a78 100644
--- a/conans/client/userio.py
+++ b/conans/client/userio.py
@@ -18,10 +18,20 @@ def color_enabled(stream):
     Command-line software which adds ANSI color to its output by default should check for the
     presence of a NO_COLOR environment variable that, when present (**regardless of its value**),
     prevents the addition of ANSI color.
+
+    CLICOLOR_FORCE: Force color
+
+    https://bixense.com/clicolors/
     """
+
     from conan.api.output import conan_output_logger_format
     if conan_output_logger_format:
         return False
+
+    if os.getenv("CLICOLOR_FORCE", "0") != "0":
+        # CLICOLOR_FORCE != 0, ANSI colors should be enabled no matter what.
+        return True
+
     if os.getenv("NO_COLOR") is not None:
         return False
     return is_terminal(stream)


Test patch:
diff --git a/conans/test/unittests/client/conan_output_test.py b/conans/test/unittests/client/conan_output_test.py
index 5d46f588d..351f0eb4b 100644
--- a/conans/test/unittests/client/conan_output_test.py
+++ b/conans/test/unittests/client/conan_output_test.py
@@ -3,6 +3,7 @@ import sys
 import unittest
 from unittest import mock
 
+import pytest
 from parameterized import parameterized
 
 from conan.api.output import ConanOutput
@@ -21,3 +22,32 @@ class ConanOutputTest(unittest.TestCase):
                 out = ConanOutput()
                 assert out.color is False
                 init.assert_not_called()
+
+
+@pytest.mark.parametrize("force", ["1", "0", "foo"])
+def test_output_forced(force):
+    env = {"CLICOLOR_FORCE": force}
+    forced = force != "0"
+    with mock.patch("colorama.init") as init:
+        with mock.patch("sys.stderr.isatty", return_value=False), \
+             mock.patch.dict("os.environ", env, clear=True):
+            init_colorama(sys.stderr)
+            out = ConanOutput()
+
+            assert out.color is forced
+            if not forced:
+                init.assert_not_called()
+
+
+def test_output_forced_but_conan_logger():
+    """ If conan is logging, no colors can be forced"""
+    env = {"CLICOLOR_FORCE": "1"}
+    with mock.patch("conan.api.output.conan_output_logger_format", return_value=True):
+        with mock.patch("colorama.init") as init:
+            with mock.patch("sys.stderr.isatty", return_value=False), \
+                 mock.patch.dict("os.environ", env, clear=True):
+                init_colorama(sys.stderr)
+                out = ConanOutput()
+
+                assert out.color is False
+                init.assert_not_called()
Repository: conan-io/conan
Pull request #12067 (2022-09-09 08:27:01)

Update clang 16 cppstd to gnu17
Changelog: Fix: Set gnu17 as clang 16 cppstd default.
Docs: https://github.com/conan-io/docs/pull/XXXX

Closes: https://github.com/conan-io/conan/issues/12066


Patch:
diff --git a/conans/client/build/cppstd_flags.py b/conans/client/build/cppstd_flags.py
index 650ecc89d..c086b3174 100644
--- a/conans/client/build/cppstd_flags.py
+++ b/conans/client/build/cppstd_flags.py
@@ -66,6 +66,8 @@ def cppstd_default(settings):
 
 
 def _clang_cppstd_default(compiler_version):
+    if Version(compiler_version) >= "16":
+        return "gnu17"
     # Official docs are wrong, in 6.0 the default is gnu14 to follow gcc's choice
     return "gnu98" if Version(compiler_version) < "6" else "gnu14"
 


Test patch:
diff --git a/conans/test/unittests/client/build/cpp_std_flags_test.py b/conans/test/unittests/client/build/cpp_std_flags_test.py
index 078663845..79d60d674 100644
--- a/conans/test/unittests/client/build/cpp_std_flags_test.py
+++ b/conans/test/unittests/client/build/cpp_std_flags_test.py
@@ -147,6 +147,10 @@ class CompilerFlagsTest(unittest.TestCase):
         self.assertEqual(_make_cppstd_default("clang", "10"), "gnu14")
         self.assertEqual(_make_cppstd_default("clang", "11"), "gnu14")
         self.assertEqual(_make_cppstd_default("clang", "12"), "gnu14")
+        self.assertEqual(_make_cppstd_default("clang", "13"), "gnu14")
+        self.assertEqual(_make_cppstd_default("clang", "14"), "gnu14")
+        self.assertEqual(_make_cppstd_default("clang", "15"), "gnu14")
+        self.assertEqual(_make_cppstd_default("clang", "16"), "gnu17")
 
     def test_apple_clang_cppstd_flags(self):
         self.assertEqual(_make_cppstd_flag("apple-clang", "3.9", "98"), None)