From b8069ee66b81b00517d0b7df333ce159abd8e707 Mon Sep 17 00:00:00 2001 From: max Date: Sat, 26 Sep 2026 13:49:58 +0200 Subject: [PATCH] ci(release): enhance Debian package installation loop and makensis binary resolution --- .gitea/workflows/release.yml | 14 ++++++++++---- compilation/package_dist.py | 14 ++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index 0399fc1..c696ba8 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -31,11 +31,17 @@ jobs: if [ "$(id -u)" -ne 0 ] && command -v sudo >/dev/null 2>&1; then SUDO="sudo" fi - $SUDO apt-get update || true - $SUDO apt-get install -y --no-install-recommends \ - build-essential nsis curl tar gzip zip python3-dev libpython3-dev || true + export DEBIAN_FRONTEND=noninteractive + $SUDO apt-get update -y || true PY_VER=$(python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')" 2>/dev/null || echo "3.9") - $SUDO apt-get install -y --no-install-recommends "libpython${PY_VER}" "libpython${PY_VER}-dev" "python${PY_VER}-dev" || true + echo "[*] Detected Python version: ${PY_VER}" + for pkg in nsis "libpython${PY_VER}" "libpython${PY_VER}-dev" "python${PY_VER}-dev" python3-dev libpython3-dev build-essential gcc make curl tar gzip zip unzip; do + $SUDO apt-get install -y --no-install-recommends "$pkg" || true + done + echo "[*] Verifying makensis:" + which makensis || echo "makensis not in PATH" + echo "[*] Verifying libpython shared library:" + find /usr/lib /usr/local/lib -name "libpython*.so*" 2>/dev/null || true fi python3 compilation/ensure_pip.py python3 -m pip install --upgrade pip --break-system-packages 2>/dev/null || python3 -m pip install --upgrade pip 2>/dev/null || true diff --git a/compilation/package_dist.py b/compilation/package_dist.py index a09cced..1764d68 100644 --- a/compilation/package_dist.py +++ b/compilation/package_dist.py @@ -140,23 +140,29 @@ def compile_nsis_installers(): """Compiles NSIS installers if makensis is available (native Linux/Windows).""" makensis_cmd = None if shutil.which("makensis"): - makensis_cmd = ["makensis"] + makensis_cmd = [shutil.which("makensis")] + elif os.path.exists("/usr/bin/makensis"): + makensis_cmd = ["/usr/bin/makensis"] + elif os.path.exists("/usr/local/bin/makensis"): + makensis_cmd = ["/usr/local/bin/makensis"] elif os.path.exists(r"C:\Program Files (x86)\NSIS\makensis.exe"): makensis_cmd = [r"C:\Program Files (x86)\NSIS\makensis.exe"] elif os.path.exists(r"C:\Program Files\NSIS\makensis.exe"): makensis_cmd = [r"C:\Program Files\NSIS\makensis.exe"] if not makensis_cmd: + print("[!] Note: NSIS compiler (makensis) not found in PATH or standard directories.") return False + compilation_dir = os.path.join(ROOT_DIR, "compilation") success = True for nsi in ["installer_client.nsi", "installer_server.nsi"]: - nsi_path = os.path.join(ROOT_DIR, "compilation", nsi) + nsi_path = os.path.join(compilation_dir, nsi) if os.path.exists(nsi_path): print(f"[*] Compiling NSIS script: {nsi} via {makensis_cmd[0]}...") try: - subprocess.run(makensis_cmd + [nsi_path], check=True) - print(f"[+] Successfully compiled {nsi}") + subprocess.run(makensis_cmd + [nsi_path], cwd=compilation_dir, check=True) + print(f"[+] Successfully compiled NSIS installer for {nsi}") except Exception as e: print(f"[!] Warning: Failed to compile {nsi} with {makensis_cmd}: {e}") success = False