Lidar_Muxa/tools/_bootstrap.py

27 lines
1.1 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""Общий пролог для инструментов: подключить пакет flyguard и найти данные."""
from __future__ import annotations
import os
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
PKG = ROOT
# Записи лидара в репозиторий не кладутся (десятки гигабайт). По умолчанию
# ищем их рядом: сначала внутри репозитория, потом на уровень выше — так
# работает и у того, кто держит клон внутри основного проекта, и у того, кто
# распаковал его отдельно. Переопределяется переменной FLYGUARD_DATA.
_env = os.environ.get("FLYGUARD_DATA")
if _env:
DATA = Path(_env)
elif (ROOT / "data" / "for_hackathon").exists():
DATA = ROOT / "data"
else:
DATA = ROOT.parent / "data"
CACHE = DATA / "cache"
ARTIFACTS = ROOT / "artifacts"
DOCS = ROOT / "docs"
FIGURES = DOCS / "figures"
if str(PKG) not in sys.path:
sys.path.insert(0, str(PKG))