import os import subprocess import sys import shutil import platform REPO_URL = "https://git.idkmail.ru/lohrrrr/TyChat-Client.git" PROJECT_DIR = "TyChat-Client-Build" VENV_DIR = os.path.join(PROJECT_DIR, "venv") ENTRY_POINT = "TUI.py" def run_cmd(cmd, cwd=None): subprocess.run(cmd, cwd=cwd, check=True) def setup_build(): if os.path.exists(PROJECT_DIR): shutil.rmtree(PROJECT_DIR) print(f"[*] Cloning repository...") run_cmd(["git", "clone", REPO_URL, PROJECT_DIR]) print(f"[*] Creating virtual environment...") run_cmd([sys.executable, "-m", "venv", VENV_DIR]) if platform.system() == "Windows": pip_path = os.path.join(VENV_DIR, "Scripts", "pip") pyinstaller_path = os.path.join(VENV_DIR, "Scripts", "pyinstaller") else: pip_path = os.path.join(VENV_DIR, "bin", "pip") pyinstaller_path = os.path.join(VENV_DIR, "bin", "pyinstaller") print(f"[*] Installing dependencies...") run_cmd([pip_path, "install", "pyinstaller", "socketio", "websocket-client", "numpy", "sounddevice", "prompt_toolkit"]) print(f"[*] Building standalone binary...") run_cmd([pyinstaller_path, "--onefile", "--name", "TyChat", ENTRY_POINT], cwd=PROJECT_DIR) print(f"\n[!] Build Complete! Find your binary in: {os.path.join(PROJECT_DIR, 'dist')}") if __name__ == "__main__": setup_build()