diff --git a/.gitignore b/.gitignore index 9be1bb7..b9f5f4e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ -# ---> jlauncher +# ---> jail-launcher # Datos descargados en tiempo de ejecución (clones git + cache de metadata) -jlauncher_data/ +jail_launcher_data/ # Preferencias locales del usuario settings.json *.dist/ diff --git a/README.md b/README.md index af162c1..ec31f60 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# jlauncher +# jail-launcher Lanzador de juegos de **jailgames**. A partir de `games.toml`, lista los juegos, los clona/actualiza desde sus repos Gitea, lee su icono y descripción, y los compila/ejecuta. @@ -15,14 +15,14 @@ GUI en **Python + PySide6**, pensada para compilarse a binario nativo con **Nuit ```bash pip install PySide6 -python -m jlauncher +python -m jail_launcher ``` -La app crea una carpeta `jlauncher_data/` junto al proyecto (o junto al binario, si está +La app crea una carpeta `jail_launcher_data/` junto al proyecto (o junto al binario, si está compilado) con esta estructura **anidada (Versión 1)**: ``` -jlauncher_data/ +jail_launcher_data/ / repo/ # git clone del juego metadata/ @@ -40,7 +40,7 @@ jlauncher_data/ - icono desde `release/icons/icon.png`. - **Juga**: si hay `build_cmd`, compila primero; luego ejecuta `run_cmd`. Para estos juegos basta `run_cmd = "make run"` (compila y ejecuta), con `build_cmd` vacío. -- **Esborra**: elimina la descarga local (carpeta del juego en `jlauncher_data/`), +- **Esborra**: elimina la descarga local (carpeta del juego en `jail_launcher_data/`), sin quitar el juego del `games.toml`. Menú **Opcions**: *Amaga els jocs no descarregats* (filtro persistente) y @@ -55,7 +55,7 @@ Una entrada `[[game]]` por juego. Campos: | Campo | Obligatorio | Descripción | |---------------|-------------|--------------------------------------------------------------------| -| `id` | sí | slug → nombre de carpeta en `jlauncher_data/` | +| `id` | sí | slug → nombre de carpeta en `jail_launcher_data/` | | `name` | sí | nombre visible | | `clone_url` | sí | URL de git clone / pull | | `run_cmd` | sí | comando que ejecuta el juego (cwd = repo) | @@ -68,16 +68,16 @@ Una entrada `[[game]]` por juego. Campos: `build.sh` lo hace todo: crea el `.venv`, instala dependencias (PySide6 + Nuitka + zstandard) y compila un único ejecutable comprimido, empaquetándolo en -`dist/jlauncher-v--.tar.gz` junto a `games.toml`. +`dist/jail-launcher-v--.tar.gz` junto a `games.toml`. ```bash ./build.sh -# binario: dist/jlauncher (+ dist/games.toml) +# binario: dist/jail-launcher (+ dist/games.toml) ``` -El binario crea `jlauncher_data/` y `settings.json` **junto a sí mismo** (resuelto vía +El binario crea `jail_launcher_data/` y `settings.json` **junto a sí mismo** (resuelto vía `NUITKA_ONEFILE_DIRECTORY`). El punto de entrada para empaquetar es `app.py` (desde -fuente se ejecuta con `python -m jlauncher`). +fuente se ejecuta con `python -m jail_launcher`). ### Prerequisitos del sistema (no los instala el script) @@ -95,8 +95,8 @@ binario suelto sino una **app nativa**: ```bash ./build.sh -# -> dist/jlauncher.app -# -> dist/jlauncher-v-macos-.dmg (arrastrar la app a Aplicaciones) +# -> dist/Jail Launcher.app +# -> dist/jail-launcher-v-macos-.dmg (arrastrar la app a Aplicaciones) ``` El icono vive en `icon/`: el build usa `icon/icon.icns` para el bundle y copia @@ -105,9 +105,9 @@ sustituye esos ficheros (regenerables con `icon/create_icons.py`). A diferencia del onefile, la `.app` **no** escribe junto a sí misma (rompería al moverla a `/Applications`): guarda sus datos en -`~/Library/Application Support/jailgames/jlauncher/` (`jlauncher_data/`, `settings.json` y +`~/Library/Application Support/jailgames/jail-launcher/` (`jail_launcher_data/`, `settings.json` y una copia editable de `games.toml`, sembrada la primera vez desde el bundle). La app va **sin firma Developer ID** (firma ad-hoc), así que Gatekeeper avisará la primera vez: ábrela con **clic derecho → Abrir**, o ejecuta -`xattr -dr com.apple.quarantine /Applications/jlauncher.app`. +`xattr -dr com.apple.quarantine "/Applications/Jail Launcher.app"`. diff --git a/app.py b/app.py index 9d94731..3c2d87d 100644 --- a/app.py +++ b/app.py @@ -1,11 +1,11 @@ """Punto de entrada para empaquetar con Nuitka. -Importa el paquete ``jlauncher`` con imports absolutos para que los imports relativos +Importa el paquete ``jail_launcher`` con imports absolutos para que los imports relativos internos (``from .config import …``) resuelvan correctamente al compilar. Para ejecutar -desde fuente sigue valiendo ``python -m jlauncher``. +desde fuente sigue valiendo ``python -m jail_launcher``. """ -from jlauncher.__main__ import main +from jail_launcher.__main__ import main if __name__ == "__main__": raise SystemExit(main()) diff --git a/build.ps1 b/build.ps1 index f479343..5ca3ab2 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,5 +1,5 @@ -# Compila jlauncher con Nuitka y empaqueta un release para Windows. -# - jlauncher.exe (onefile, GUI sin consola, con icono) + games.toml + .zip. +# Compila jail-launcher con Nuitka y empaqueta un release para Windows. +# - jail-launcher.exe (onefile, GUI sin consola, con icono) + games.toml + .zip. # Equivalente nativo de build.sh (que cubre Linux/macOS). # Requisitos del sistema (no los instala el script): # - Python 3.10+ (con el launcher «py» o «python» en el PATH). @@ -16,12 +16,12 @@ Set-StrictMode -Version Latest $Here = Split-Path -Parent $MyInvocation.MyCommand.Path Set-Location $Here -# --- Versión (leída de jlauncher/__init__.py) --------------------------------- -$initPath = Join-Path $Here 'jlauncher\__init__.py' +# --- Versión (leída de jail_launcher/__init__.py) --------------------------------- +$initPath = Join-Path $Here 'jail_launcher\__init__.py' $verMatch = Select-String -Path $initPath -Pattern '^__version__\s*=\s*"([^"]*)"' | Select-Object -First 1 if (-not $verMatch) { - Write-Error '[build] no se pudo leer __version__ de jlauncher/__init__.py' + Write-Error '[build] no se pudo leer __version__ de jail_launcher/__init__.py' } $Version = $verMatch.Matches[0].Groups[1].Value @@ -90,29 +90,29 @@ if (-not (Test-Path $IconIco)) { } # --- Compilación onefile ------------------------------------------------------ -Write-Host '[build] compilando jlauncher.exe (PySide6 onefile; puede tardar varios minutos)…' +Write-Host '[build] compilando jail-launcher.exe (PySide6 onefile; puede tardar varios minutos)…' & $VenvPython -m nuitka ` --onefile ` --assume-yes-for-downloads ` --enable-plugin=pyside6 ` - --include-package=jlauncher ` + --include-package=jail_launcher ` --windows-icon-from-ico=$IconIco ` --windows-console-mode=disable ` --company-name=jailgames ` - --product-name=jlauncher ` + --product-name=jail-launcher ` --product-version=$Version ` --file-version=$Version ` --output-dir=dist ` - --output-filename=jlauncher ` + --output-filename=jail-launcher ` --remove-output ` app.py if ($LASTEXITCODE -ne 0) { Write-Error '[build] Nuitka falló.' } -$Exe = 'dist\jlauncher.exe' +$Exe = 'dist\jail-launcher.exe' if (-not (Test-Path $Exe)) { - Write-Error '[build] Nuitka no produjo dist\jlauncher.exe' + Write-Error '[build] Nuitka no produjo dist\jail-launcher.exe' } # games.toml junto al .exe (la app lo lee desde ahí: base_dir junto al binario). @@ -125,14 +125,14 @@ New-Item -ItemType Directory -Force -Path dist\icon | Out-Null Copy-Item $IconPng dist\icon\icon.png -Force # --- Empaquetado .zip --------------------------------------------------------- -$ReleaseName = "jlauncher-v$Version-windows-$Arch" +$ReleaseName = "jail-launcher-v$Version-windows-$Arch" $Zip = "dist\$ReleaseName.zip" Write-Host "[build] empaquetando release $ReleaseName.zip…" -Compress-Archive -Path dist\jlauncher.exe, dist\games.toml, dist\icon ` +Compress-Archive -Path dist\jail-launcher.exe, dist\games.toml, dist\icon ` -DestinationPath $Zip -Force Write-Host '[build] hecho:' -Get-Item dist\jlauncher.exe, dist\games.toml, $Zip | +Get-Item dist\jail-launcher.exe, dist\games.toml, $Zip | Format-Table -AutoSize Name, @{Name = 'Size'; Expression = { '{0:N0} B' -f $_.Length } } -Write-Host '[build] el binario crea jlauncher_data\ y settings.json junto a sí mismo.' -Write-Host '[build] distribuir: descomprimir el .zip (jlauncher.exe + games.toml + icon\ juntos).' +Write-Host '[build] el binario crea jail_launcher_data\ y settings.json junto a sí mismo.' +Write-Host '[build] distribuir: descomprimir el .zip (jail-launcher.exe + games.toml + icon\ juntos).' diff --git a/build.sh b/build.sh index 1d996c9..64376ff 100755 --- a/build.sh +++ b/build.sh @@ -1,16 +1,16 @@ #!/usr/bin/env bash -# Compila jlauncher con Nuitka y empaqueta un release. +# Compila jail-launcher con Nuitka y empaqueta un release. # - Linux: binario onefile + tar.gz. -# - macOS: jlauncher.app (con icono) dentro de un .dmg arrastrable a /Applications. +# - macOS: «Jail Launcher.app» (con icono) dentro de un .dmg arrastrable a /Applications. # Requisitos del sistema (no los instala el script): ver README (compilador C, git…). set -euo pipefail HERE="$(cd "$(dirname "$0")" && pwd)" cd "$HERE" -VERSION="$(sed -n 's/^__version__[[:space:]]*=[[:space:]]*"\([^"]*\)".*/\1/p' jlauncher/__init__.py | head -n1)" +VERSION="$(sed -n 's/^__version__[[:space:]]*=[[:space:]]*"\([^"]*\)".*/\1/p' jail_launcher/__init__.py | head -n1)" if [ -z "$VERSION" ]; then - echo "[build] no se pudo leer __version__ de jlauncher/__init__.py" >&2 + echo "[build] no se pudo leer __version__ de jail_launcher/__init__.py" >&2 exit 1 fi ARCH="$(uname -m)" @@ -52,28 +52,29 @@ if [ "$OS" = "darwin" ]; then exit 1 fi - echo "[build] compilando jlauncher.app (PySide6; puede tardar varios minutos)…" + echo "[build] compilando «Jail Launcher.app» (PySide6; puede tardar varios minutos)…" .venv/bin/python -m nuitka \ --standalone \ --macos-create-app-bundle \ --macos-app-icon="$ICON_ICNS" \ --macos-app-name="Jail Launcher" \ --macos-app-version="$VERSION" \ - --macos-signed-app-name=com.jailgames.jlauncher \ + --macos-signed-app-name=com.jailgames.jail-launcher \ --company-name=jailgames \ - --product-name=jlauncher \ + --product-name=jail-launcher \ --product-version="$VERSION" \ --assume-yes-for-downloads \ --enable-plugin=pyside6 \ - --include-package=jlauncher \ + --include-package=jail_launcher \ --output-dir=dist \ - --output-filename=jlauncher \ + --output-filename=jail-launcher \ --remove-output \ app.py # Según la versión, Nuitka nombra el bundle a partir del script de entrada - # (app.py -> app.app). Lo normalizamos a jlauncher.app. - APP="dist/jlauncher.app" + # (app.py -> app.app). Lo normalizamos a «Jail Launcher.app» (nombre visible en + # Finder/Dock; el ejecutable interno sigue siendo jail-launcher). + APP="dist/Jail Launcher.app" if [ ! -d "$APP" ]; then PRODUCED="$(find dist -maxdepth 1 -name '*.app' | head -n1)" if [ -z "$PRODUCED" ]; then @@ -91,35 +92,35 @@ if [ "$OS" = "darwin" ]; then # Bundle ad-hoc (sin Developer ID): quitamos quarantine para abrir sin fricción local. xattr -dr com.apple.quarantine "$APP" 2>/dev/null || true - DMG="dist/jlauncher-v${VERSION}-macos-${ARCH}.dmg" + DMG="dist/jail-launcher-v${VERSION}-macos-${ARCH}.dmg" echo "[build] empaquetando ${DMG}…" STAGE="$(mktemp -d)" cp -R "$APP" "$STAGE/" ln -s /Applications "$STAGE/Applications" rm -f "$DMG" - hdiutil create -volname "jlauncher" -srcfolder "$STAGE" \ + hdiutil create -volname "Jail Launcher" -srcfolder "$STAGE" \ -ov -format UDZO "$DMG" >/dev/null rm -rf "$STAGE" echo "[build] hecho:" du -sh "$APP" | sed 's/^/[build] /' ls -lh "$DMG" - echo "[build] la app guarda datos en ~/Library/Application Support/jailgames/jlauncher/." - echo "[build] distribuir: el .dmg (arrastrar jlauncher.app a Aplicaciones)." + echo "[build] la app guarda datos en ~/Library/Application Support/jailgames/jail-launcher/." + echo "[build] distribuir: el .dmg (arrastrar «Jail Launcher.app» a Aplicaciones)." echo "[build] sin firma Developer ID: primera apertura con clic derecho → Abrir." else # ------------------------------------------------------------------------- # Linux (y resto): binario onefile + tar.gz # ------------------------------------------------------------------------- - RELEASE_NAME="jlauncher-v${VERSION}-${OS}-${ARCH}" + RELEASE_NAME="jail-launcher-v${VERSION}-${OS}-${ARCH}" echo "[build] compilando (PySide6 onefile; puede tardar varios minutos)…" .venv/bin/python -m nuitka \ --onefile \ --assume-yes-for-downloads \ --enable-plugin=pyside6 \ - --include-package=jlauncher \ + --include-package=jail_launcher \ --output-dir=dist \ - --output-filename=jlauncher \ + --output-filename=jail-launcher \ --remove-output \ --lto=yes \ app.py @@ -128,10 +129,10 @@ else cp games.toml dist/games.toml echo "[build] empaquetando release ${RELEASE_NAME}.tar.gz…" - tar -czf "dist/${RELEASE_NAME}.tar.gz" -C dist jlauncher games.toml + tar -czf "dist/${RELEASE_NAME}.tar.gz" -C dist jail-launcher games.toml echo "[build] hecho:" - ls -lh "dist/jlauncher" "dist/games.toml" "dist/${RELEASE_NAME}.tar.gz" - echo "[build] el binario crea jlauncher_data/ y settings.json junto a sí mismo." - echo "[build] distribuir: descomprimir el tar.gz (jlauncher + games.toml juntos)." + ls -lh "dist/jail-launcher" "dist/games.toml" "dist/${RELEASE_NAME}.tar.gz" + echo "[build] el binario crea jail_launcher_data/ y settings.json junto a sí mismo." + echo "[build] distribuir: descomprimir el tar.gz (jail-launcher + games.toml juntos)." fi diff --git a/games.toml b/games.toml index 5dd7104..4aa0bcd 100644 --- a/games.toml +++ b/games.toml @@ -1,7 +1,7 @@ -# Configuración de jlauncher — lista de juegos. +# Configuración de jail-launcher — lista de juegos. # # Campos por juego ([[game]]): -# id (obligatorio) slug interno → nombre de carpeta en jlauncher_data/ +# id (obligatorio) slug interno → nombre de carpeta en jail_launcher_data/ # name (obligatorio) nombre visible en la lista # clone_url (obligatorio) URL para git clone / git pull # run_cmd (obligatorio) comando que ejecuta el juego (cwd = repo clonado) @@ -15,7 +15,7 @@ # Otros pills (topics, descripción, fecha de lanzamiento, versión) salen # automáticamente de Gitea / git; no hace falta escribirlos aquí. -data_dir = "jlauncher_data" +data_dir = "jail_launcher_data" [[game]] id = "coffee_crisis" diff --git a/jail_launcher/__init__.py b/jail_launcher/__init__.py new file mode 100644 index 0000000..9c3f871 --- /dev/null +++ b/jail_launcher/__init__.py @@ -0,0 +1,3 @@ +"""jail-launcher — lanzador de juegos jailgames.""" + +__version__ = "1.0.5" diff --git a/jlauncher/__main__.py b/jail_launcher/__main__.py similarity index 97% rename from jlauncher/__main__.py rename to jail_launcher/__main__.py index 15f8016..9257b6e 100644 --- a/jlauncher/__main__.py +++ b/jail_launcher/__main__.py @@ -15,7 +15,7 @@ from .ui.theme import apply_theme def main() -> int: app = QApplication(sys.argv) - app.setApplicationName("jlauncher") + app.setApplicationName("jail-launcher") # No fixem applicationDisplayName: a Windows/X11 Qt l'afegeix al títol de la # finestra ("títol - displayName") i duplicaria «Jail Launcher», que ja surt # a WINDOW_TITLE. El nom de l'app al menú de macOS ve del bundle (Nuitka). diff --git a/jlauncher/config.py b/jail_launcher/config.py similarity index 95% rename from jlauncher/config.py rename to jail_launcher/config.py index f755b8b..a2698ef 100644 --- a/jlauncher/config.py +++ b/jail_launcher/config.py @@ -31,7 +31,7 @@ class Game: @dataclass class Config: - data_dir: str = "jlauncher_data" + data_dir: str = "jail_launcher_data" games: list[Game] = field(default_factory=list) @@ -80,4 +80,4 @@ def load_config(path: Path) -> Config: if not games: raise ValueError("games.toml no define ningún [[game]]") - return Config(data_dir=raw.get("data_dir", "jlauncher_data"), games=games) + return Config(data_dir=raw.get("data_dir", "jail_launcher_data"), games=games) diff --git a/jlauncher/gitops.py b/jail_launcher/gitops.py similarity index 100% rename from jlauncher/gitops.py rename to jail_launcher/gitops.py diff --git a/jlauncher/metadata.py b/jail_launcher/metadata.py similarity index 100% rename from jlauncher/metadata.py rename to jail_launcher/metadata.py diff --git a/jlauncher/paths.py b/jail_launcher/paths.py similarity index 89% rename from jlauncher/paths.py rename to jail_launcher/paths.py index 48a94d9..3fbd18b 100644 --- a/jlauncher/paths.py +++ b/jail_launcher/paths.py @@ -3,7 +3,7 @@ Compilado con Nuitka, ``__compiled__`` existe. En modo ``--onefile`` la carpeta del binario real la expone ``NUITKA_ONEFILE_DIRECTORY`` (Nuitka 4.x); con versiones que usan ``NUITKA_ONEFILE_BINARY`` tomamos su carpeta; si no, ``sys.executable`` (standalone). -Ejecutando desde fuente usamos la raíz del proyecto (la carpeta que contiene ``jlauncher``). +Ejecutando desde fuente usamos la raíz del proyecto (la carpeta que contiene ``jail_launcher``). """ from __future__ import annotations @@ -17,7 +17,7 @@ CONFIG_NAME = "games.toml" # Carpeta de soporte en macOS cuando corremos como .app: ~/Library/Application Support/… APP_SUPPORT_VENDOR = "jailgames" -APP_SUPPORT_APP = "jlauncher" +APP_SUPPORT_APP = "jail-launcher" def is_compiled() -> bool: @@ -26,7 +26,7 @@ def is_compiled() -> bool: def base_dir() -> Path: - """Carpeta base junto a la que viven games.toml y jlauncher_data.""" + """Carpeta base junto a la que viven games.toml y jail_launcher_data.""" if is_compiled(): directory = os.environ.get("NUITKA_ONEFILE_DIRECTORY") if directory: @@ -35,14 +35,14 @@ def base_dir() -> Path: if binary: return Path(binary).resolve().parent return Path(sys.executable).resolve().parent - # Desde fuente: raíz del proyecto = padre del paquete jlauncher/ + # Desde fuente: raíz del proyecto = padre del paquete jail_launcher/ return Path(__file__).resolve().parent.parent def macos_app_bundle() -> Path | None: - """Ruta del .app si corremos como bundle de macOS (``…/jlauncher.app``); si no, None. + """Ruta del .app si corremos como bundle de macOS (``…/jail-launcher.app``); si no, None. - En un app bundle el ejecutable vive en ``…/jlauncher.app/Contents/MacOS/jlauncher``, + En un app bundle el ejecutable vive en ``…/jail-launcher.app/Contents/MacOS/jail-launcher``, dentro de un árbol no escribible al instalarse en ``/Applications``. Detectarlo nos deja redirigir datos y settings a ``~/Library/Application Support``. """ @@ -106,7 +106,7 @@ def config_file() -> Path: return base_dir() / CONFIG_NAME -def data_root(data_dir: str = "jlauncher_data") -> Path: +def data_root(data_dir: str = "jail_launcher_data") -> Path: """Carpeta raíz de datos; se crea si no existe.""" root = writable_base() / data_dir root.mkdir(parents=True, exist_ok=True) diff --git a/jlauncher/runner.py b/jail_launcher/runner.py similarity index 100% rename from jlauncher/runner.py rename to jail_launcher/runner.py diff --git a/jlauncher/settings.py b/jail_launcher/settings.py similarity index 100% rename from jlauncher/settings.py rename to jail_launcher/settings.py diff --git a/jail_launcher/ui/__init__.py b/jail_launcher/ui/__init__.py new file mode 100644 index 0000000..6c1eaf9 --- /dev/null +++ b/jail_launcher/ui/__init__.py @@ -0,0 +1 @@ +"""Componentes de interfaz de jail-launcher.""" diff --git a/jlauncher/ui/flow_layout.py b/jail_launcher/ui/flow_layout.py similarity index 100% rename from jlauncher/ui/flow_layout.py rename to jail_launcher/ui/flow_layout.py diff --git a/jlauncher/ui/game_row.py b/jail_launcher/ui/game_row.py similarity index 100% rename from jlauncher/ui/game_row.py rename to jail_launcher/ui/game_row.py diff --git a/jlauncher/ui/main_window.py b/jail_launcher/ui/main_window.py similarity index 100% rename from jlauncher/ui/main_window.py rename to jail_launcher/ui/main_window.py diff --git a/jlauncher/ui/theme.py b/jail_launcher/ui/theme.py similarity index 100% rename from jlauncher/ui/theme.py rename to jail_launcher/ui/theme.py diff --git a/jlauncher/workers.py b/jail_launcher/workers.py similarity index 100% rename from jlauncher/workers.py rename to jail_launcher/workers.py diff --git a/jlauncher/__init__.py b/jlauncher/__init__.py deleted file mode 100644 index e035038..0000000 --- a/jlauncher/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -"""jlauncher — lanzador de juegos jailgames.""" - -__version__ = "1.0.5" diff --git a/jlauncher/ui/__init__.py b/jlauncher/ui/__init__.py deleted file mode 100644 index f92f60a..0000000 --- a/jlauncher/ui/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Componentes de interfaz de jlauncher.""" diff --git a/pyproject.toml b/pyproject.toml index f3ca772..e9170d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [project] -name = "jlauncher" +name = "jail-launcher" version = "1.0.4" description = "Lanzador de juegos jailgames: clona, compila y ejecuta repos Gitea" requires-python = ">=3.11" @@ -8,11 +8,11 @@ dependencies = [ ] [project.scripts] -jlauncher = "jlauncher.__main__:main" +jail-launcher = "jail_launcher.__main__:main" [build-system] requires = ["setuptools>=68"] build-backend = "setuptools.build_meta" [tool.setuptools] -packages = ["jlauncher", "jlauncher.ui"] +packages = ["jail_launcher", "jail_launcher.ui"]