v1.0.0: añade --version, empaqueta release tar.gz, elimina wrapper

This commit is contained in:
2026-05-18 09:08:06 +02:00
parent 0721f1fc3a
commit b1e859a9a5
4 changed files with 30 additions and 7 deletions
+15 -2
View File
@@ -1,11 +1,20 @@
#!/usr/bin/env bash
# Compila gitswarm a un binario standalone con Nuitka.
# Compila gitswarm a un binario standalone con Nuitka y empaqueta un tar.gz de release.
# Requisitos del sistema: python3-dev, gcc, patchelf (ver README).
set -euo pipefail
HERE="$(cd "$(dirname "$0")" && pwd)"
cd "$HERE"
VERSION="$(grep -oP '__version__\s*=\s*"\K[^"]+' gitswarm.py)"
if [ -z "$VERSION" ]; then
echo "[build] no se pudo leer __version__ de gitswarm.py" >&2
exit 1
fi
ARCH="$(uname -m)"
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
RELEASE_NAME="gitswarm-v${VERSION}-${OS}-${ARCH}"
if [ ! -d .venv ]; then
echo "[build] creando venv…"
python3 -m venv .venv
@@ -18,6 +27,7 @@ if ! .venv/bin/python -c "import nuitka" 2>/dev/null; then
.venv/bin/pip install --quiet nuitka
fi
echo "[build] versión: v${VERSION}"
echo "[build] limpiando artefactos previos…"
rm -rf dist build gitswarm.build gitswarm.dist gitswarm.onefile-build
@@ -32,6 +42,9 @@ echo "[build] compilando (esto puede tardar 1-2 min)…"
--include-package=rich \
gitswarm.py
echo "[build] empaquetando release ${RELEASE_NAME}.tar.gz…"
tar -czf "dist/${RELEASE_NAME}.tar.gz" -C dist gitswarm
echo "[build] hecho:"
ls -lh dist/gitswarm
ls -lh "dist/gitswarm" "dist/${RELEASE_NAME}.tar.gz"
echo "[build] instalar con: cp dist/gitswarm ~/.local/bin/"
-4
View File
@@ -1,4 +0,0 @@
#!/usr/bin/env bash
# Wrapper que ejecuta gitswarm.py dentro del venv local.
HERE="$(cd "$(dirname "$0")" && pwd)"
exec "$HERE/.venv/bin/python" "$HERE/gitswarm.py" "$@"
+14 -1
View File
@@ -16,6 +16,8 @@ from rich.prompt import Prompt
from rich.table import Table
from rich.text import Text
__version__ = "1.0.0"
console = Console()
@@ -211,13 +213,16 @@ HELP = """[bold]Comandos:[/bold]
[cyan]refresh[/cyan] / [cyan]r[/cyan] Re-escanea haciendo git fetch
[cyan]update <repo>[/cyan] git pull --ff-only en ese repo (acepta nº, nombre o trozo)
[cyan]update all[/cyan] Actualiza todos los que estén behind
[cyan]version[/cyan] / [cyan]v[/cyan] Muestra la versión
[cyan]help[/cyan] / [cyan]?[/cyan] Esta ayuda
[cyan]quit[/cyan] / [cyan]q[/cyan] Salir (también Ctrl-D / Ctrl-C)
"""
def repl(base: Path) -> None:
console.print(f"[dim]gitswarm — escaneando[/dim] [bold]{base}[/bold]")
console.print(
f"[dim]gitswarm v{__version__} — escaneando[/dim] [bold]{base}[/bold]"
)
repos = scan(base, fetch=True)
if not repos:
console.print(f"[yellow]No se han encontrado repos git en {base}[/yellow]")
@@ -245,6 +250,8 @@ def repl(base: Path) -> None:
console.print(HELP)
elif cmd in ("list", "ls"):
console.print(render_table(repos))
elif cmd in ("version", "v"):
console.print(f"gitswarm v{__version__}")
elif cmd in ("refresh", "r"):
repos = scan(base, fetch=True)
console.print(render_table(repos))
@@ -262,6 +269,12 @@ def main() -> int:
prog="gitswarm",
description="Lista y actualiza repos git de primer nivel en una carpeta.",
)
parser.add_argument(
"-v",
"--version",
action="version",
version=f"gitswarm v{__version__}",
)
parser.add_argument("path", type=Path, help="Carpeta a escanear")
args = parser.parse_args()
if not args.path.is_dir():
+1
View File
@@ -1 +1,2 @@
rich>=13.0
zstandard>=0.22