Merge pysim-otaman-server into otaman (monorepo, v1.7.0)
- Move PWA into frontend/; server package at pysim_otaman_server/ - Server now serves the PWA (same origin -> no CORS/PNA): static file handler + --web-dir flag + injects window.PYSIM_EMBEDDED marker into index.html - Frontend defaults to relative API base when embedded (pysimBase = '') - Version 1.7.0 aligned: server.py VERSION, pyproject.toml, PWA header - SW cache bump otaman-v7 -> otaman-v8 - Docs: combined README + docs/api.md endpoint reference; update links - Fix stale package.json repository URL
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import importlib.util
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def load_pysim_app():
|
||||
import pySim
|
||||
pysim_dir = os.path.dirname(pySim.__file__)
|
||||
candidates = [
|
||||
os.path.join(os.path.dirname(pysim_dir), 'pySim-shell.py'),
|
||||
os.path.join(os.path.dirname(sys.executable), 'pySim-shell.py'),
|
||||
]
|
||||
for path in candidates:
|
||||
if os.path.exists(path):
|
||||
spec = importlib.util.spec_from_file_location("pySim_shell", path)
|
||||
mod = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(mod)
|
||||
return mod
|
||||
raise ImportError(
|
||||
"pySim-shell.py not found. Make sure pysim is installed "
|
||||
"(pip install pysim) and pySim-shell.py is on the PATH."
|
||||
)
|
||||
Reference in New Issue
Block a user