Skip to content

Commit 8834425

Browse files
committed
refactor: remove legacy frozen runtime compatibility path
1 parent 8761e11 commit 8834425

1 file changed

Lines changed: 0 additions & 38 deletions

File tree

main.py

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,9 @@
22
import asyncio
33
import mimetypes
44
import os
5-
import runpy
65
import sys
76
from pathlib import Path
87

9-
10-
def _run_python_compat_mode_if_needed() -> None:
11-
"""Support subprocess calls that expect a Python interpreter in frozen mode."""
12-
if not getattr(sys, "frozen", False):
13-
return
14-
15-
if len(sys.argv) < 2:
16-
return
17-
18-
command = sys.argv[1]
19-
20-
if command == "-c":
21-
if len(sys.argv) < 3:
22-
raise SystemExit("astrbot-backend: argument expected for -c")
23-
code = sys.argv[2]
24-
sys.argv = ["-c", *sys.argv[3:]]
25-
exec(code, {"__name__": "__main__", "__package__": None, "__spec__": None}) # noqa: S102
26-
raise SystemExit(0)
27-
28-
if command == "-m":
29-
if len(sys.argv) < 3:
30-
raise SystemExit("astrbot-backend: argument expected for -m")
31-
module_name = sys.argv[2]
32-
sys.argv = [module_name, *sys.argv[3:]]
33-
runpy.run_module(module_name, run_name="__main__", alter_sys=True)
34-
raise SystemExit(0)
35-
36-
script_path = Path(command)
37-
if script_path.is_file():
38-
resolved_script = script_path.resolve().as_posix()
39-
sys.argv = [resolved_script, *sys.argv[2:]]
40-
runpy.run_path(resolved_script, run_name="__main__")
41-
raise SystemExit(0)
42-
43-
44-
_run_python_compat_mode_if_needed()
45-
468
import runtime_bootstrap # noqa: E402
479

4810
runtime_bootstrap.initialize_runtime_bootstrap()

0 commit comments

Comments
 (0)