"Auto-commit via make git"
This commit is contained in:
parent
b2f1b14ad9
commit
02759319c3
@ -32,6 +32,6 @@ AM_PATH_PYTHON([3.0])
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
src/Makefile
|
||||
src/manager/Makefile
|
||||
src/builder/Makefile
|
||||
])
|
||||
AC_OUTPUT
|
||||
|
||||
BIN
dist/releases/neoricalex-0eab785-dirty-src.tar.gz
vendored
BIN
dist/releases/neoricalex-0eab785-dirty-src.tar.gz
vendored
Binary file not shown.
Binary file not shown.
BIN
dist/releases/neoricalex-2dfd2c1-dirty-src.tar.gz
vendored
BIN
dist/releases/neoricalex-2dfd2c1-dirty-src.tar.gz
vendored
Binary file not shown.
BIN
dist/releases/neoricalex-b6961cd-dirty-src.tar.gz
vendored
BIN
dist/releases/neoricalex-b6961cd-dirty-src.tar.gz
vendored
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
SUBDIRS = manager
|
||||
SUBDIRS = builder
|
||||
|
||||
bin_SCRIPTS = neoricalex
|
||||
CLEANFILES = $(bin_SCRIPTS)
|
||||
|
||||
@ -15,25 +15,25 @@ class Application(object):
|
||||
|
||||
def run(self):
|
||||
self._ensure_venv()
|
||||
self.launch_welcome()
|
||||
self.launch_neoricalex()
|
||||
|
||||
def _ensure_venv(self):
|
||||
"""Cria e ativa o ambiente virtual, caso ainda não exista."""
|
||||
"""Cria e ativa o ambiente Python, 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...")
|
||||
print("[+] Criando ambiente Python...")
|
||||
subprocess.run([sys.executable, "-m", "venv", str(venv_path)], check=True)
|
||||
else:
|
||||
print("[=] Ambiente virtual já existente.")
|
||||
print("[=] Ambiente Python já existente.")
|
||||
|
||||
|
||||
def launch_welcome(self):
|
||||
"""Lança o gestor de módulos."""
|
||||
def launch_neoricalex(self):
|
||||
"""Lança o neoricalex."""
|
||||
base_path = Path(__file__).resolve().parent
|
||||
manager = base_path / "manager" / "manager_main.py"
|
||||
subprocess.run(["python3", str(manager)])
|
||||
neoricalex = base_path / "builder" / "__main__.py"
|
||||
subprocess.run(["python3", str(neoricalex)])
|
||||
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
# ===========================
|
||||
# Módulos Python do Manager
|
||||
# Módulos Python do neoricalex
|
||||
# ===========================
|
||||
|
||||
# Diretório de instalação Python
|
||||
@ -7,10 +7,7 @@ neoricalexdir = $(pythondir)
|
||||
|
||||
# Fontes do manager
|
||||
dist_neoricalex_PYTHON = \
|
||||
manager_main.py \
|
||||
manifest_parser.py \
|
||||
module_loader.py \
|
||||
tui_manager.py \
|
||||
__main__.py \
|
||||
__init__.py
|
||||
|
||||
# Inclui o bootstrap (nível acima) como parte deste pacote
|
||||
1
src/builder/__main__.py
Normal file
1
src/builder/__main__.py
Normal file
@ -0,0 +1 @@
|
||||
print("NEORICALEX — ambiente ok")
|
||||
@ -1,81 +0,0 @@
|
||||
from rich.console import Console
|
||||
from rich.table import Table
|
||||
from pathlib import Path
|
||||
import os, subprocess, json
|
||||
|
||||
console = Console()
|
||||
BASE_DIR = Path(__file__).resolve().parents[2]
|
||||
MODULES_FILE = BASE_DIR / "src" / "modules.json"
|
||||
MODULES_DIR = BASE_DIR / "src" / "modules"
|
||||
|
||||
def load_modules():
|
||||
if MODULES_FILE.exists():
|
||||
with open(MODULES_FILE) as f:
|
||||
data = json.load(f)
|
||||
return data.get("modules", [])
|
||||
return []
|
||||
|
||||
def clone_module(mod):
|
||||
path = Path(mod["path"])
|
||||
if not path.exists():
|
||||
console.print(f"[cyan]📦 Clonando {mod['name']}...[/cyan]")
|
||||
subprocess.run(["git", "clone", mod["repo"], str(path)], check=True)
|
||||
else:
|
||||
console.print(f"[yellow]✔ {mod['name']} já existe localmente.[/yellow]")
|
||||
|
||||
def update_module(mod):
|
||||
path = Path(mod["path"])
|
||||
if path.exists():
|
||||
console.print(f"[blue]🔄 Atualizando {mod['name']}...[/blue]")
|
||||
subprocess.run(["git", "-C", str(path), "pull"], check=True)
|
||||
else:
|
||||
console.print(f"[red]⚠ Módulo {mod['name']} não encontrado![/red]")
|
||||
|
||||
def run_module(mod):
|
||||
path = Path(mod["path"])
|
||||
if not path.exists():
|
||||
console.print(f"[red]❌ Módulo {mod['name']} não encontrado.[/red]")
|
||||
return
|
||||
console.print(f"[green]🚀 Executando {mod['name']}...[/green]")
|
||||
subprocess.run(mod["entrypoint"], cwd=path, shell=True)
|
||||
|
||||
def menu():
|
||||
modules = load_modules()
|
||||
while True:
|
||||
console.clear()
|
||||
table = Table(title="NEORICALEX – System Manager")
|
||||
table.add_column("ID", justify="center")
|
||||
table.add_column("Módulo")
|
||||
table.add_column("Ação")
|
||||
|
||||
for i, mod in enumerate(modules, start=1):
|
||||
table.add_row(str(i), mod["name"], mod["repo"])
|
||||
table.add_row("0", "Sair", "")
|
||||
|
||||
console.print(table)
|
||||
choice = console.input("[cyan]\nSelecione um módulo> [/cyan]")
|
||||
|
||||
if choice == "0":
|
||||
break
|
||||
if not choice.isdigit() or int(choice) > len(modules):
|
||||
continue
|
||||
|
||||
mod = modules[int(choice)-1]
|
||||
console.print(f"[bold yellow]Selecionado:[/bold yellow] {mod['name']}")
|
||||
console.print("[1] Executar [2] Atualizar [3] Reinstalar [0] Voltar")
|
||||
sub = console.input("[cyan]> [/cyan]")
|
||||
|
||||
if sub == "1":
|
||||
run_module(mod)
|
||||
elif sub == "2":
|
||||
update_module(mod)
|
||||
elif sub == "3":
|
||||
if Path(mod["path"]).exists():
|
||||
subprocess.run(["rm", "-rf", mod["path"]])
|
||||
clone_module(mod)
|
||||
else:
|
||||
continue
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.makedirs(MODULES_DIR, exist_ok=True)
|
||||
menu()
|
||||
@ -1,16 +0,0 @@
|
||||
{
|
||||
"modules": [
|
||||
{
|
||||
"name": "my_os",
|
||||
"repo": "https://gitea.neoricalex.com/neo/my_os.git",
|
||||
"path": "src/modules/my_os",
|
||||
"entrypoint": "python3 tui/menu_main.py"
|
||||
},
|
||||
{
|
||||
"name": "my_distro",
|
||||
"repo": "https://gitea.neoricalex.com/neo/my_distro.git",
|
||||
"path": "src/modules/my_distro",
|
||||
"entrypoint": "bash build.sh"
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -6,6 +6,6 @@ sys.path.insert(1, '/usr/local/local/lib/python3.12/dist-packages')
|
||||
from bootstrap import Application
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = Application(package="neoricalex", version="b6961cd-dirty")
|
||||
app = Application(package="neoricalex", version="2dfd2c1-dirty-2-gb2f1b14-dirty")
|
||||
app.run()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user