summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2019-03-04 21:36:23 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-03-05 22:28:11 +0000
commit713f44e0e0cde9b818c214002fd8b730d422fafa (patch)
treebd2cf3e19c90565a6ad08ae3e14d4c135dfdaa4c /scripts
parent7930f114aff8e00e777a26656e465f1fe43780b5 (diff)
downloadopenembedded-core-contrib-713f44e0e0cde9b818c214002fd8b730d422fafa.tar.gz
openembedded-core-contrib-713f44e0e0cde9b818c214002fd8b730d422fafa.tar.bz2
openembedded-core-contrib-713f44e0e0cde9b818c214002fd8b730d422fafa.zip
oe.scriptutils: enable color in a more flexible way
Rather than recreating handlers and forcing them, iterate over the handlers and enable color on ones we can handle. This makes it easier to handle color properly when we introduce the bb.msg default log filters. Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/scriptutils.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/scripts/lib/scriptutils.py b/scripts/lib/scriptutils.py
index 3c60c3a1e6..0633c7066e 100644
--- a/scripts/lib/scriptutils.py
+++ b/scripts/lib/scriptutils.py
@@ -39,12 +39,12 @@ def logger_create(name, stream=None):
def logger_setup_color(logger, color='auto'):
from bb.msg import BBLogFormatter
- console = logging.StreamHandler(sys.stdout)
- formatter = BBLogFormatter("%(levelname)s: %(message)s")
- console.setFormatter(formatter)
- logger.handlers = [console]
- if color == 'always' or (color=='auto' and console.stream.isatty()):
- formatter.enable_color()
+
+ for handler in logger.handlers:
+ if (isinstance(handler, logging.StreamHandler) and
+ isinstance(handler.formatter, BBLogFormatter)):
+ if color == 'always' or (color == 'auto' and handler.stream.isatty()):
+ handler.formatter.enable_color()
def load_plugins(logger, plugins, pluginpath):
@@ -69,6 +69,7 @@ def load_plugins(logger, plugins, pluginpath):
plugin.plugin_init(plugins)
plugins.append(plugin)
+
def git_convert_standalone_clone(repodir):
"""If specified directory is a git repository, ensure it's a standalone clone"""
import bb.process