fix: fdb shadowing scan ignores generated build output (dist/build bundles contain fdb)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
gti
2026-09-24 11:18:21 -03:00
co-authored by Claude Sonnet 5
parent f5f05d87e6
commit 065cdc4eff
+10 -3
View File
@@ -53,12 +53,19 @@ def _metadata_value(metadata: Any, name: str) -> Any:
return None return None
_BUILD_OUTPUT_DIRS = {"dist", "build", ".pytmp", ".git", "node_modules", "__pycache__", ".venv", "venv"}
def _project_shadowing() -> list[str]: def _project_shadowing() -> list[str]:
"""Source-tree files that could shadow the approved fdb driver. Generated output (PyInstaller dist/build
bundles legitimately contain their own fdb package) is not part of the import path and is skipped."""
findings: list[str] = [] findings: list[str] = []
try: try:
for path in PROJECT_ROOT.rglob("*"): for root, dirs, files in os.walk(PROJECT_ROOT):
if path.name in {"fdb.py", "fdb"} or path.suffix == ".pth": dirs[:] = [d for d in dirs if d not in _BUILD_OUTPUT_DIRS]
findings.append(str(path.resolve(strict=False))) for name in dirs + files:
if name in {"fdb.py", "fdb"} or name.endswith(".pth"):
findings.append(str((Path(root) / name).resolve(strict=False)))
except OSError: except OSError:
return ["<project-scan-unavailable>"] return ["<project-scan-unavailable>"]
return sorted(set(findings)) return sorted(set(findings))