refactor: 入口脚本迁移到 bin/
将 4 个入口脚本从根目录迁移到 bin/: - run_cli.py - gui_app.py - webgui_launcher.py - manage_logs.py 配套修改: - 修复 bin/*.py 内部 ROOT_DIR 计算(parent.parent) - bin/run_cli.py 在 sys.path 加入项目根,shim 加载逻辑保持不变 - bin/manage_logs.py 在 sys.path 加入项目根 - path_config.get_run_cli_path() 返回 bin/run_cli.py 启动方式变化: - 原: python run_cli.py / python gui_app.py - 新: python bin/run_cli.py / python bin/gui_app.py GUI 内部通过 path_config.get_run_cli_path() 调用,自动适配。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
309b629e7c
commit
e3e399da70
5 files changed
+9
-6
No files matched your search
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Compatibility launcher for the Web GUI launcher window."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import runpy
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT_DIR = Path(__file__).resolve().parent.parent
|
||||
TARGET = ROOT_DIR / "gui" / "webgui_launcher.py"
|
||||
VENV_PYTHON = ROOT_DIR / ".venv" / "Scripts" / "python.exe"
|
||||
|
||||
|
||||
def _reexec_with_venv() -> None:
|
||||
if not VENV_PYTHON.exists():
|
||||
return
|
||||
if Path(sys.executable).resolve() == VENV_PYTHON.resolve():
|
||||
return
|
||||
os.execv(str(VENV_PYTHON), [str(VENV_PYTHON), str(TARGET), *sys.argv[1:]])
|
||||
|
||||
|
||||
def main() -> None:
|
||||
_reexec_with_venv()
|
||||
sys.argv = [str(TARGET), *sys.argv[1:]]
|
||||
runpy.run_path(str(TARGET), run_name="__main__")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in new issue
Block a user