summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMarius Kriegerowski <marius.kriegerowski@gmail.com>2022-04-14 20:22:59 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-07-01 12:46:45 +0100
commit4cc94de99230201c3c39b924219113157ff47006 (patch)
treef578f141cdb0cd5f6a49bc9b288990bd74494b21 /scripts
parent73f9326d2a7c6a60c805da6e2e7ffae4071c1062 (diff)
downloadpoky-4cc94de99230201c3c39b924219113157ff47006.tar.gz
scriptutils: fix style to be more PEP8 compliant
(From OE-Core rev: 61b346d6c309ebfef50c88260bf5a0650c74db16) Signed-off-by: Marius Kriegerowski <marius.kriegerowski@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/scriptutils.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/scripts/lib/scriptutils.py b/scripts/lib/scriptutils.py
index adf81476f0..f7c1bd9e4e 100644
--- a/scripts/lib/scriptutils.py
+++ b/scripts/lib/scriptutils.py
@@ -5,7 +5,6 @@
5# SPDX-License-Identifier: GPL-2.0-only 5# SPDX-License-Identifier: GPL-2.0-only
6# 6#
7 7
8import argparse
9import glob 8import glob
10import logging 9import logging
11import os 10import os
@@ -25,7 +24,7 @@ class KeepAliveStreamHandler(logging.StreamHandler):
25 def __init__(self, keepalive=True, **kwargs): 24 def __init__(self, keepalive=True, **kwargs):
26 super().__init__(**kwargs) 25 super().__init__(**kwargs)
27 if keepalive is True: 26 if keepalive is True:
28 keepalive = 5000 # default timeout 27 keepalive = 5000 # default timeout
29 self._timeout = threading.Condition() 28 self._timeout = threading.Condition()
30 self._stop = False 29 self._stop = False
31 30
@@ -36,9 +35,9 @@ class KeepAliveStreamHandler(logging.StreamHandler):
36 with self._timeout: 35 with self._timeout:
37 if not self._timeout.wait(keepalive): 36 if not self._timeout.wait(keepalive):
38 self.emit(logging.LogRecord("keepalive", logging.INFO, 37 self.emit(logging.LogRecord("keepalive", logging.INFO,
39 None, None, "Keepalive message", None, None)) 38 None, None, "Keepalive message", None, None))
40 39
41 self._thread = threading.Thread(target = thread, daemon = True) 40 self._thread = threading.Thread(target=thread, daemon=True)
42 self._thread.start() 41 self._thread.start()
43 42
44 def close(self): 43 def close(self):
@@ -72,16 +71,15 @@ def logger_setup_color(logger, color='auto'):
72 71
73 for handler in logger.handlers: 72 for handler in logger.handlers:
74 if (isinstance(handler, logging.StreamHandler) and 73 if (isinstance(handler, logging.StreamHandler) and
75 isinstance(handler.formatter, BBLogFormatter)): 74 isinstance(handler.formatter, BBLogFormatter)):
76 if color == 'always' or (color == 'auto' and handler.stream.isatty()): 75 if color == 'always' or (color == 'auto' and handler.stream.isatty()):
77 handler.formatter.enable_color() 76 handler.formatter.enable_color()
78 77
79 78
80def load_plugins(logger, plugins, pluginpath): 79def load_plugins(logger, plugins, pluginpath):
81
82 def load_plugin(name): 80 def load_plugin(name):
83 logger.debug('Loading plugin %s' % name) 81 logger.debug('Loading plugin %s' % name)
84 spec = importlib.machinery.PathFinder.find_spec(name, path=[pluginpath] ) 82 spec = importlib.machinery.PathFinder.find_spec(name, path=[pluginpath])
85 if spec: 83 if spec:
86 mod = importlib.util.module_from_spec(spec) 84 mod = importlib.util.module_from_spec(spec)
87 spec.loader.exec_module(mod) 85 spec.loader.exec_module(mod)