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:
@@ -8,6 +8,8 @@ Blender to produce GLBs. Its manifest is consumed by write_web_showcase.py.
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import shutil
|
||||
import os
|
||||
import copy
|
||||
import json
|
||||
import subprocess
|
||||
@@ -38,6 +40,13 @@ VARIANTS = [
|
||||
|
||||
|
||||
def default_blender() -> str:
|
||||
"""Blender executable: env BLENDER > PATH > macOS app-bundle default."""
|
||||
override = os.environ.get("BLENDER")
|
||||
if override:
|
||||
return override
|
||||
found = shutil.which("blender")
|
||||
if found:
|
||||
return found
|
||||
return "/Applications/Blender.app/Contents/MacOS/Blender"
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user