mirror of
https://git.yoctoproject.org/poky
synced 2026-07-09 20:13:41 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
73f9326d2a
commit
4cc94de992
@@ -5,7 +5,6 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0-only
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
#
|
#
|
||||||
|
|
||||||
import argparse
|
|
||||||
import glob
|
import glob
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@@ -25,7 +24,7 @@ class KeepAliveStreamHandler(logging.StreamHandler):
|
|||||||
def __init__(self, keepalive=True, **kwargs):
|
def __init__(self, keepalive=True, **kwargs):
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
if keepalive is True:
|
if keepalive is True:
|
||||||
keepalive = 5000 # default timeout
|
keepalive = 5000 # default timeout
|
||||||
self._timeout = threading.Condition()
|
self._timeout = threading.Condition()
|
||||||
self._stop = False
|
self._stop = False
|
||||||
|
|
||||||
@@ -36,9 +35,9 @@ class KeepAliveStreamHandler(logging.StreamHandler):
|
|||||||
with self._timeout:
|
with self._timeout:
|
||||||
if not self._timeout.wait(keepalive):
|
if not self._timeout.wait(keepalive):
|
||||||
self.emit(logging.LogRecord("keepalive", logging.INFO,
|
self.emit(logging.LogRecord("keepalive", logging.INFO,
|
||||||
None, None, "Keepalive message", None, None))
|
None, None, "Keepalive message", None, None))
|
||||||
|
|
||||||
self._thread = threading.Thread(target = thread, daemon = True)
|
self._thread = threading.Thread(target=thread, daemon=True)
|
||||||
self._thread.start()
|
self._thread.start()
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
@@ -72,16 +71,15 @@ def logger_setup_color(logger, color='auto'):
|
|||||||
|
|
||||||
for handler in logger.handlers:
|
for handler in logger.handlers:
|
||||||
if (isinstance(handler, logging.StreamHandler) and
|
if (isinstance(handler, logging.StreamHandler) and
|
||||||
isinstance(handler.formatter, BBLogFormatter)):
|
isinstance(handler.formatter, BBLogFormatter)):
|
||||||
if color == 'always' or (color == 'auto' and handler.stream.isatty()):
|
if color == 'always' or (color == 'auto' and handler.stream.isatty()):
|
||||||
handler.formatter.enable_color()
|
handler.formatter.enable_color()
|
||||||
|
|
||||||
|
|
||||||
def load_plugins(logger, plugins, pluginpath):
|
def load_plugins(logger, plugins, pluginpath):
|
||||||
|
|
||||||
def load_plugin(name):
|
def load_plugin(name):
|
||||||
logger.debug('Loading plugin %s' % name)
|
logger.debug('Loading plugin %s' % name)
|
||||||
spec = importlib.machinery.PathFinder.find_spec(name, path=[pluginpath] )
|
spec = importlib.machinery.PathFinder.find_spec(name, path=[pluginpath])
|
||||||
if spec:
|
if spec:
|
||||||
mod = importlib.util.module_from_spec(spec)
|
mod = importlib.util.module_from_spec(spec)
|
||||||
spec.loader.exec_module(mod)
|
spec.loader.exec_module(mod)
|
||||||
|
|||||||
Reference in New Issue
Block a user