Portability: Blender/ODA discovery via env > PATH > macOS default

The two hardcoded macOS paths in code become last-resort defaults:
- build_showcase_variants: env BLENDER > shutil.which("blender") > app bundle
- cad_dxf_report: env ODA_CONVERTER > shutil.which("ODAFileConverter") > app
  bundle (env override existed already; PATH lookup is new)
Docs annotate the macOS example paths with the discovery order.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-04 15:05:32 +08:00
parent 23cf3af678
commit b871a2f8bd
4 changed files with 20 additions and 4 deletions

View File

@@ -86,10 +86,13 @@ def run_dwg2dxf(source: Path, dest: Path) -> dict:
def oda_converter() -> str | None:
"""ODA File Converter path (env ODA_CONVERTER overrides the macOS default)."""
"""ODA File Converter: env ODA_CONVERTER > PATH > macOS app-bundle default."""
override = os.environ.get("ODA_CONVERTER")
if override:
return override if Path(override).exists() else None
found = shutil.which("ODAFileConverter")
if found:
return found
default = Path("/Applications/ODAFileConverter.app/Contents/MacOS/ODAFileConverter")
return str(default) if default.exists() else None