v1.0.0: añade --version, empaqueta release tar.gz, elimina wrapper
This commit is contained in:
@@ -1,11 +1,20 @@
|
|||||||
#!/usr/bin/env bash
|
#!/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).
|
# Requisitos del sistema: python3-dev, gcc, patchelf (ver README).
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
HERE="$(cd "$(dirname "$0")" && pwd)"
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
||||||
cd "$HERE"
|
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
|
if [ ! -d .venv ]; then
|
||||||
echo "[build] creando venv…"
|
echo "[build] creando venv…"
|
||||||
python3 -m venv .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
|
.venv/bin/pip install --quiet nuitka
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "[build] versión: v${VERSION}"
|
||||||
echo "[build] limpiando artefactos previos…"
|
echo "[build] limpiando artefactos previos…"
|
||||||
rm -rf dist build gitswarm.build gitswarm.dist gitswarm.onefile-build
|
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 \
|
--include-package=rich \
|
||||||
gitswarm.py
|
gitswarm.py
|
||||||
|
|
||||||
|
echo "[build] empaquetando release ${RELEASE_NAME}.tar.gz…"
|
||||||
|
tar -czf "dist/${RELEASE_NAME}.tar.gz" -C dist gitswarm
|
||||||
|
|
||||||
echo "[build] hecho:"
|
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/"
|
echo "[build] instalar con: cp dist/gitswarm ~/.local/bin/"
|
||||||
|
|||||||
@@ -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
@@ -16,6 +16,8 @@ from rich.prompt import Prompt
|
|||||||
from rich.table import Table
|
from rich.table import Table
|
||||||
from rich.text import Text
|
from rich.text import Text
|
||||||
|
|
||||||
|
__version__ = "1.0.0"
|
||||||
|
|
||||||
console = Console()
|
console = Console()
|
||||||
|
|
||||||
|
|
||||||
@@ -211,13 +213,16 @@ HELP = """[bold]Comandos:[/bold]
|
|||||||
[cyan]refresh[/cyan] / [cyan]r[/cyan] Re-escanea haciendo git fetch
|
[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 <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]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]help[/cyan] / [cyan]?[/cyan] Esta ayuda
|
||||||
[cyan]quit[/cyan] / [cyan]q[/cyan] Salir (también Ctrl-D / Ctrl-C)
|
[cyan]quit[/cyan] / [cyan]q[/cyan] Salir (también Ctrl-D / Ctrl-C)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def repl(base: Path) -> None:
|
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)
|
repos = scan(base, fetch=True)
|
||||||
if not repos:
|
if not repos:
|
||||||
console.print(f"[yellow]No se han encontrado repos git en {base}[/yellow]")
|
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)
|
console.print(HELP)
|
||||||
elif cmd in ("list", "ls"):
|
elif cmd in ("list", "ls"):
|
||||||
console.print(render_table(repos))
|
console.print(render_table(repos))
|
||||||
|
elif cmd in ("version", "v"):
|
||||||
|
console.print(f"gitswarm v{__version__}")
|
||||||
elif cmd in ("refresh", "r"):
|
elif cmd in ("refresh", "r"):
|
||||||
repos = scan(base, fetch=True)
|
repos = scan(base, fetch=True)
|
||||||
console.print(render_table(repos))
|
console.print(render_table(repos))
|
||||||
@@ -262,6 +269,12 @@ def main() -> int:
|
|||||||
prog="gitswarm",
|
prog="gitswarm",
|
||||||
description="Lista y actualiza repos git de primer nivel en una carpeta.",
|
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")
|
parser.add_argument("path", type=Path, help="Carpeta a escanear")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if not args.path.is_dir():
|
if not args.path.is_dir():
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
rich>=13.0
|
rich>=13.0
|
||||||
|
zstandard>=0.22
|
||||||
|
|||||||
Reference in New Issue
Block a user