diff mbox series

[3/3] lib: remove bb.fetch shim module; cleanup fallout

Message ID 20260821170624.436725-4-chris.laplante@agilent.com
State New
Headers show
Series Remove bb.fetch compatibility shim module | expand

Commit Message

chris.laplante@agilent.com Aug. 21, 2026, 5:06 p.m. UTC
From: Chris Laplante <chris.laplante@agilent.com>

fetch2 replaced fetch a long time ago (2012) so I argue it is time to
say goodbye the bb.fetch shim.

In doing so, we reveal and cleanup a few circular imports and transitive
imports that must now be explicit.

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
---
 lib/bb/__init__.py   |  4 +---
 lib/bb/build.py      |  2 +-
 lib/bb/cookerdata.py | 11 +++++++++--
 3 files changed, 11 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/lib/bb/__init__.py b/lib/bb/__init__.py
index bc5e9d82b..049c87ef0 100644
--- a/lib/bb/__init__.py
+++ b/lib/bb/__init__.py
@@ -90,6 +90,7 @@  class BBLoggerMixin(object):
         return self.bbdebug(3, *args, **kwargs)
 
     def bbdebug(self, level, msg, *args, **kwargs):
+        import bb.event
         loglevel = logging.DEBUG - level + 1
         if not bb.event.worker_pid:
             if self.name in bb.msg.loggerDefaultDomains and loglevel > (bb.msg.loggerDefaultDomains[self.name]):
@@ -152,9 +153,6 @@  class PrefixLoggerAdapter(logging.LoggerAdapter):
 # can result in construction of the various loggers.
 import bb.msg
 
-from bb import fetch2 as fetch
-sys.modules['bb.fetch'] = sys.modules['bb.fetch2']
-
 # Messaging convenience functions
 def plain(*args):
     """
diff --git a/lib/bb/build.py b/lib/bb/build.py
index 40839a81b..8b49721d6 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -24,7 +24,6 @@  import datetime
 import bb
 import bb.msg
 import bb.process
-import bb.progress
 from io import StringIO
 from bb import data, event, utils
 
@@ -387,6 +386,7 @@  esac
 '''
 
 def create_progress_handler(func, progress, logfile, d):
+    import bb.progress
     if progress == 'percent':
         # Use default regex
         return bb.progress.BasicProgressHandler(d, outfile=logfile)
diff --git a/lib/bb/cookerdata.py b/lib/bb/cookerdata.py
index c5fcd71be..eedfd5406 100644
--- a/lib/bb/cookerdata.py
+++ b/lib/bb/cookerdata.py
@@ -16,9 +16,16 @@  import re
 import sys
 import hashlib
 from functools import wraps
-import bb
-from bb import data
+
+import bb.cache
+import bb.codeparser
+import bb.data
+import bb.data
+import bb.data_smart
+import bb.event
+import bb.fetch2
 import bb.parse
+import bb.utils
 
 logger      = logging.getLogger("BitBake")
 parselog    = logging.getLogger("BitBake.Parsing")