26 lines
1.0 KiB
Python
26 lines
1.0 KiB
Python
|
|
# -*- coding: utf-8 -*-
|
|||
|
|
"""路径与 sys.path 引导:让 harness 能 import tools/ 下的现有脚本."""
|
|||
|
|
from __future__ import annotations
|
|||
|
|
|
|||
|
|
import os
|
|||
|
|
import sys
|
|||
|
|
|
|||
|
|
HARNESS_DIR = os.path.dirname(os.path.abspath(__file__))
|
|||
|
|
TOOLS_DIR = os.path.dirname(HARNESS_DIR) # .../tools
|
|||
|
|
REPO_DIR = os.path.dirname(TOOLS_DIR) # .../YNGJ-GT1-M - AT32F403ARCT7
|
|||
|
|
WORKSPACE_DIR = os.path.dirname(os.path.dirname(REPO_DIR)) # .../一诺国际吉他
|
|||
|
|
DOC_REPORTS_DIR = os.path.join(WORKSPACE_DIR, "Doc", "reports")
|
|||
|
|
LOCAL_REPORTS_DIR = os.path.join(TOOLS_DIR, "out", "reports")
|
|||
|
|
|
|||
|
|
if TOOLS_DIR not in sys.path:
|
|||
|
|
sys.path.insert(0, TOOLS_DIR)
|
|||
|
|
|
|||
|
|
|
|||
|
|
def default_report_dir() -> str:
|
|||
|
|
"""报告默认落到 Doc/reports(与工作区现有 BLE 报告一致);不存在则用 tools/out/reports."""
|
|||
|
|
if os.path.isdir(os.path.join(WORKSPACE_DIR, "Doc")):
|
|||
|
|
os.makedirs(DOC_REPORTS_DIR, exist_ok=True)
|
|||
|
|
return DOC_REPORTS_DIR
|
|||
|
|
os.makedirs(LOCAL_REPORTS_DIR, exist_ok=True)
|
|||
|
|
return LOCAL_REPORTS_DIR
|