diff mbox series

[bitbake-devel,2/2] tinfoil.py: avoid undefined variable error

Message ID 20230926101440.3610057-2-Qi.Chen@windriver.com
State New
Headers show
Series [bitbake-devel,1/2] bitbake-getvar: further supress warnings when quiet option is supplied | expand

Commit Message

ChenQi Sept. 26, 2023, 10:14 a.m. UTC
From: Chen Qi <Qi.Chen@windriver.com>

When setup_logging is False, self.localhandlers is not defined
yet will be possibly used in prepare.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 lib/bb/tinfoil.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/lib/bb/tinfoil.py b/lib/bb/tinfoil.py
index 91fbf1b13..8fed21dca 100644
--- a/lib/bb/tinfoil.py
+++ b/lib/bb/tinfoil.py
@@ -325,11 +325,11 @@  class Tinfoil:
         self.recipes_parsed = False
         self.quiet = 0
         self.oldhandlers = self.logger.handlers[:]
+        self.localhandlers = []
         if setup_logging:
             # This is the *client-side* logger, nothing to do with
             # logging messages from the server
             bb.msg.logger_create('BitBake', output)
-            self.localhandlers = []
             for handler in self.logger.handlers:
                 if handler not in self.oldhandlers:
                     self.localhandlers.append(handler)