File size: 1,902 Bytes
0490201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<<<<<<< HEAD
"""Bootstrap Unreal's embedded Python with the shared Synesthesia environment."""

from __future__ import annotations

import glob
import pathlib
import platform
import sys


def _log(message: str) -> None:
    prefix = "[Synesthesia Unreal Python]"
    try:
        import unreal  # type: ignore

        unreal.log(f"{prefix} {message}")
    except Exception:
        print(f"{prefix} {message}")


def _project_root() -> pathlib.Path:
    script_path = pathlib.Path(__file__).resolve()
    return script_path.parents[2]


def _candidate_site_packages(venv_root: pathlib.Path) -> list[pathlib.Path]:
    if platform.system() == "Windows":
        return [venv_root / "Lib" / "site-packages"]

    candidates = [venv_root / "lib" / "python3.12" / "site-packages"]
    for path in sorted(glob.glob(str(venv_root / "lib" / "python3*" / "site-packages"))):
        candidates.append(pathlib.Path(path))
    return candidates


def _append_path(path: pathlib.Path) -> None:
    resolved = str(path.resolve())
    if resolved not in sys.path:
        sys.path.append(resolved)
        _log(f"Added to sys.path: {resolved}")


def bootstrap() -> None:
    root = _project_root()
    venv_root = root / ".venv"
    if not venv_root.exists():
        _log(f"Root .venv not found at {venv_root}")
        return

    site_packages = next((path for path in _candidate_site_packages(venv_root) if path.exists()), None)
    if site_packages is None:
        _log(f"No site-packages directory found under {venv_root}")
        return

    _append_path(site_packages)

    ml_pipeline = root / "ML_Pipeline"
    if ml_pipeline.exists():
        _append_path(ml_pipeline)


bootstrap()
=======
import unreal

def init():
    unreal.log("Synesthesia initialized.")
    # Initialize subsystems, paths, etc.

if __name__ == "__main__":
    init()
>>>>>>> ws1-rocm-model-export-pipeline-6323038014816139641