import os import shutil import subprocess import sys from pathlib import Path class Application(object): def __init__(self, *args, **kwargs): for key in kwargs: setattr(self, key, kwargs[key]) self._hello() def _hello(self): print(f"NEORICALEX {getattr(self, 'version', '')} — inicializador de ambiente") def run(self): self._ensure_venv() self.launch_welcome() def _ensure_venv(self): """Cria e ativa o ambiente virtual, caso ainda não exista.""" base_path = Path(__file__).resolve().parents[1] venv_path = base_path / "venv" os.chdir(base_path) if not venv_path.exists(): print("[+] Criando ambiente virtual...") subprocess.run([sys.executable, "-m", "venv", str(venv_path)], check=True) else: print("[=] Ambiente virtual já existente.") def launch_welcome(self): """Lança o gestor de módulos.""" base_path = Path(__file__).resolve().parent manager = base_path / "manager" / "manager_main.py" subprocess.run(["python3", str(manager)])