ci(release): add dynamic fallback package resolution and support suite changes in runner
CI Test Suite / Run Component Tests & Pipeline Verification (push) Successful in 1m24s
Release Binaries & Packages / Build & Release Standalone Binaries (Linux & Windows Cross-Compilation) (push) Successful in 1m34s

This commit is contained in:
2026-09-26 13:57:09 +02:00
parent b8069ee66b
commit b33294f36c
2 changed files with 74 additions and 21 deletions
+53 -13
View File
@@ -136,24 +136,63 @@ def create_windows_exe_zipapp(script_name, exe_name):
print(f"[+] Successfully cross-compiled Windows PE executable: {exe_name}.exe (PE Stub attached: {bool(stub_bytes)})")
def ensure_makensis():
"""Finds or attempts to install makensis on the current system."""
for cmd in ["makensis", "/usr/bin/makensis", "/usr/local/bin/makensis",
r"C:\Program Files (x86)\NSIS\makensis.exe",
r"C:\Program Files\NSIS\makensis.exe"]:
p = shutil.which(cmd) if not os.path.isabs(cmd) else cmd
if p and (os.path.exists(p) or shutil.which(p)):
return p
if platform.system() == "Linux":
print("[*] Attempting to install 'nsis' package dynamically...")
sudo = ["sudo"] if hasattr(os, "geteuid") and os.geteuid() != 0 and shutil.which("sudo") else []
if shutil.which("apt-get"):
try:
subprocess.run(sudo + ["apt-get", "update", "--allow-releaseinfo-change", "-y"], check=False)
subprocess.run(sudo + ["apt-get", "install", "-y", "--no-install-recommends", "nsis"], check=False)
except Exception as e:
print(f"[!] Warning: Dynamic apt install failed: {e}")
elif shutil.which("apk"):
try:
subprocess.run(sudo + ["apk", "add", "--no-cache", "nsis"], check=False)
except Exception:
pass
elif shutil.which("dnf"):
try:
subprocess.run(sudo + ["dnf", "install", "-y", "mingw32-nsis", "nsis"], check=False)
except Exception:
pass
for cmd in ["makensis", "/usr/bin/makensis", "/usr/local/bin/makensis"]:
p = shutil.which(cmd) if not os.path.isabs(cmd) else cmd
if p and (os.path.exists(p) or shutil.which(p)):
return p
return None
def ensure_libpython():
"""Attempts to install libpython shared library on Debian/Ubuntu for PyInstaller."""
if platform.system() == "Linux" and shutil.which("apt-get"):
py_ver = f"{sys.version_info.major}.{sys.version_info.minor}"
sudo = ["sudo"] if hasattr(os, "geteuid") and os.geteuid() != 0 and shutil.which("sudo") else []
try:
subprocess.run(sudo + ["apt-get", "update", "--allow-releaseinfo-change", "-y"], check=False)
subprocess.run(sudo + ["apt-get", "install", "-y", "--no-install-recommends", f"libpython{py_ver}", "python3-dev", f"python{py_ver}-dev"], check=False)
except Exception:
pass
def compile_nsis_installers():
"""Compiles NSIS installers if makensis is available (native Linux/Windows)."""
makensis_cmd = None
if shutil.which("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:
makensis_bin = ensure_makensis()
if not makensis_bin:
print("[!] Note: NSIS compiler (makensis) not found in PATH or standard directories.")
return False
makensis_cmd = [makensis_bin]
compilation_dir = os.path.join(ROOT_DIR, "compilation")
success = True
for nsi in ["installer_client.nsi", "installer_server.nsi"]:
@@ -288,6 +327,7 @@ def build_linux():
is_linux_host = platform.system() == "Linux"
if is_linux_host:
ensure_libpython()
try:
linux_client_script = os.path.join(SRC_DIR, "Linux_Client.py")
build_pyinstaller_binary(linux_client_script, "Linux_Client.bin")