Versioned JSON skeletons without invented ohms/mm/ps. RECOMMENDED is not FAIL-mandatory; typical-as-standard is rejected. Report Protocolli is empty until recognition (M1+). Native src overlays inherited periscopex on the package path.
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
"""Backend package facade: native Periscope + inherited PinScope.
|
|
|
|
``periscope/src/backend`` and ``periscope/dependency/backend`` are merged via
|
|
pkgutil path extension. Do not put application modules in this directory.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
from pkgutil import extend_path
|
|
|
|
_REPO = Path(__file__).resolve().parents[1]
|
|
_SRC = _REPO / "periscope" / "src"
|
|
_DEP = _REPO / "periscope" / "dependency"
|
|
# Last insert is searched first: native src overlays inherited dependency.
|
|
for _p in (_DEP, _SRC):
|
|
_s = str(_p)
|
|
if not _p.is_dir():
|
|
continue
|
|
if _s in sys.path:
|
|
sys.path.remove(_s)
|
|
sys.path.insert(0, _s)
|
|
|
|
|
|
def _prefer_native_backend(paths: list[str]) -> list[str]:
|
|
src, other, dep = [], [], []
|
|
for p in paths:
|
|
norm = p.replace("\\", "/")
|
|
if "/periscope/src/" in norm:
|
|
src.append(p)
|
|
elif "/periscope/dependency/" in norm:
|
|
dep.append(p)
|
|
else:
|
|
other.append(p)
|
|
return src + other + dep
|
|
|
|
|
|
__path__ = _prefer_native_backend(list(extend_path(__path__, __name__)))
|