diff mbox series

lib/oe/distro_check: use vendored bs4

Message ID 20261122172922.2337113-1-tim.orling@konsulko.com
State Under Review
Headers show
Series lib/oe/distro_check: use vendored bs4 | expand

Commit Message

Tim Orling Nov. 22, 2026, 5:29 p.m. UTC
bitbake moved its bundled bs4 to bb._vendor.bs4 (4b4b9c60f "lib:
Vendorize bundled third-party libraries under bb._vendor"), so
"from bs4 import" only works if the host has its own bs4 installed.
Without it, get_links_from_url() fails, and the selftest added in
cc911c5eae ("lib/oe/distro_check: fix the openSUSE Leap package lists")
skips itself. Import from bb._vendor.bs4, as bb.fetch.wget does, and
drop the skip.

Tested with "python3 -m unittest oeqa.selftest.cases.oelib.distro_check"
on a host without bs4: the test is no longer skipped and passes.

Suggested-by: Paul Barker <paul@pbarker.dev>
AI-Generated: Uses Claude Code (Claude Opus 5.5)
Signed-off-by: Tim Orling <tim.orling@konsulko.com>
---
 meta/lib/oe/distro_check.py                        | 2 +-
 meta/lib/oeqa/selftest/cases/oelib/distro_check.py | 4 ----
 2 files changed, 1 insertion(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/meta/lib/oe/distro_check.py b/meta/lib/oe/distro_check.py
index d8e487318c..74862bdd8f 100644
--- a/meta/lib/oe/distro_check.py
+++ b/meta/lib/oe/distro_check.py
@@ -17,7 +17,7 @@  def create_socket(url, d):
 def get_links_from_url(url, d):
     "Return all the href links found on the web location"
 
-    from bs4 import BeautifulSoup, SoupStrainer
+    from bb._vendor.bs4 import BeautifulSoup, SoupStrainer
 
     soup = BeautifulSoup(create_socket(url,d), "html.parser", parse_only=SoupStrainer("a"))
     hyperlinks = []
diff --git a/meta/lib/oeqa/selftest/cases/oelib/distro_check.py b/meta/lib/oeqa/selftest/cases/oelib/distro_check.py
index d783384251..583e5dcbf6 100644
--- a/meta/lib/oeqa/selftest/cases/oelib/distro_check.py
+++ b/meta/lib/oeqa/selftest/cases/oelib/distro_check.py
@@ -62,10 +62,6 @@  class TestOpenSUSE(TestCase):
 <a href="./15.6/">15.6/</a> <a href="./16.0/">16.0/</a> <a href="./42.3/">42.3/</a>"""
 
     def test_links_relative_to_current_directory(self):
-        try:
-            from bs4 import BeautifulSoup, SoupStrainer
-        except ImportError:
-            self.skipTest("bs4 is not available")
         with mock.patch.object(oe.distro_check, "create_socket", return_value=io.BytesIO(self.LISTING)):
             links = oe.distro_check.get_links_from_url("http://example.com/leap/", None)
         self.assertEqual(links, ["..", "15.0-Current", "15.6", "16.0", "42.3"])