extension: fix importlib_resources detection for U-Boot v2024.x-v2025.04#9692
Conversation
U-Boot v2024.x through v2025.04 has "import importlib_resources" inside
a try/except fallback block. The previous check ('importlib_resources' in
content) treated that string as a proper alias and skipped adding the import,
leaving importlib_resources undefined at runtime.
Fix: use a regex anchored to the start of line to detect only a real
top-level alias import.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe script's detection of Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Problem
After merging #9407, three CI jobs failed with:
Affected boards:
tinkerboard-2,h96-tvbox-3566,coolpi-genbook— all using U-Bootv2025.04.Root Cause
U-Boot v2024.x–v2025.04 has this pattern in
tools/binman/control.py:The previous check
'importlib_resources' in contentmatched the string inside theexceptclause and incorrectly concluded the alias already existed — skipping the import. After removingimport pkg_resources, calls toimportlib_resources.files(...)were left without a valid import.Fix
Replace the string check with a regex anchored to the start of line:
U-Boot v2024.x–v2025.04 now falls through to the "no top-level import" branch and receives a proper
try/exceptalias block.Testing
Summary by CodeRabbit