16 lines
415 B
Python
16 lines
415 B
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import os
|
||
|
|
from pathlib import Path
|
||
|
|
|
||
|
|
|
||
|
|
REPO_ROOT = Path(__file__).resolve().parents[1]
|
||
|
|
MISSING_ROOT = REPO_ROOT / "tests" / ".external-data-not-configured"
|
||
|
|
|
||
|
|
|
||
|
|
def external_dir(env_name: str, fallback_name: str) -> Path:
|
||
|
|
configured = (os.environ.get(env_name) or "").strip()
|
||
|
|
if configured:
|
||
|
|
return Path(configured).expanduser()
|
||
|
|
return MISSING_ROOT / fallback_name
|