"""Resolve bundled legacy dependencies without hard-coded cluster paths.""" from pathlib import Path import os def legacy_root(root): if os.getenv('REFSEG_LEGACY_ROOT'):return Path(os.environ['REFSEG_LEGACY_ROOT']).resolve() root=Path(root) for p in [root/'legacy_project',root.parent/'refseg_scale_20260906',root.parent/'RefSeg_Scale_MVA']: if p.exists():return p raise FileNotFoundError('Bundled legacy_project missing; set REFSEG_LEGACY_ROOT')