supercov-engine 0.0.52

Rust instrumentation, evidence, attribution, and query engine for Supercov
Documentation
"""Supercov interpreter start-up hook.

Placed first on `PYTHONPATH` by the Supercov CLI so every interpreter the
wrapped test command launches installs the runtime before user code runs.
Any `sitecustomize` the environment already provides is imported afterwards
so its behaviour is preserved.
"""

import importlib.machinery
import importlib.util
import os
import sys

_HERE = os.path.dirname(os.path.abspath(__file__))

try:
    if os.environ.get("SUPERCOV_PYTHON_PLAN"):
        import supercov_runtime

        supercov_runtime.install()
except Exception as error:  # noqa: BLE001 - never break the user's interpreter
    sys.stderr.write(f"[supercov] start-up hook failed: {error!r}\n")

try:
    _remaining = [
        entry
        for entry in sys.path
        if os.path.abspath(entry or os.getcwd()) != _HERE
    ]
    _spec = importlib.machinery.PathFinder.find_spec("sitecustomize", _remaining)
    if _spec is not None and _spec.loader is not None:
        _module = importlib.util.module_from_spec(_spec)
        _spec.loader.exec_module(_module)
except Exception as error:  # noqa: BLE001
    sys.stderr.write(f"[supercov] chained sitecustomize failed: {error!r}\n")