()
| 93 | |
| 94 | |
| 95 | def ensure_python_deps() -> None: |
| 96 | missing = [] |
| 97 | try: |
| 98 | import flask # noqa: F401 |
| 99 | except Exception: |
| 100 | missing.append("flask") |
| 101 | try: |
| 102 | import requests # noqa: F401 |
| 103 | except Exception: |
| 104 | missing.append("requests") |
| 105 | if not missing: |
| 106 | return |
| 107 | if is_termux() and which("pkg"): |
| 108 | _run(["pkg", "update", "-y"]) |
| 109 | _run(["pkg", "install", "-y", "python"]) |
| 110 | if not _run([sys.executable, "-m", "pip", "install", "--upgrade", *missing]): |
| 111 | print("Failed to install Python dependencies.") |
| 112 | print("Try in Termux:") |
| 113 | print(" pkg install python") |
| 114 | print(" pip install flask requests") |
| 115 | sys.exit(1) |
| 116 | os.execv(sys.executable, [sys.executable] + sys.argv) |
| 117 | |
| 118 | |
| 119 | def ensure_openssl() -> None: |
no test coverage detected