fix(ci): add native NSIS installer compilation and libpython3 dev dependencies for Linux runner
This commit is contained in:
@@ -136,6 +136,33 @@ 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 compile_nsis_installers():
|
||||
"""Compiles NSIS installers if makensis is available (native Linux/Windows)."""
|
||||
makensis_cmd = None
|
||||
if shutil.which("makensis"):
|
||||
makensis_cmd = ["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:
|
||||
return False
|
||||
|
||||
success = True
|
||||
for nsi in ["installer_client.nsi", "installer_server.nsi"]:
|
||||
nsi_path = os.path.join(ROOT_DIR, "compilation", 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}")
|
||||
except Exception as e:
|
||||
print(f"[!] Warning: Failed to compile {nsi} with {makensis_cmd}: {e}")
|
||||
success = False
|
||||
return success
|
||||
|
||||
|
||||
def compile_inno_setup_installers():
|
||||
"""Compiles Inno Setup installers if iscc or innosetup wrapper is available."""
|
||||
iscc_cmd = None
|
||||
@@ -173,6 +200,11 @@ def compile_inno_setup_installers():
|
||||
return True
|
||||
|
||||
|
||||
def compile_windows_installers():
|
||||
if not compile_nsis_installers():
|
||||
compile_inno_setup_installers()
|
||||
|
||||
|
||||
def build_windows():
|
||||
print("[*] Compiling Windows standalone executables...")
|
||||
is_windows_host = platform.system() == "Windows"
|
||||
@@ -192,7 +224,7 @@ def build_windows():
|
||||
create_windows_exe_zipapp("Win_Client.py", "Win_Client")
|
||||
create_windows_exe_zipapp("Server.py", "Server")
|
||||
|
||||
compile_inno_setup_installers()
|
||||
compile_windows_installers()
|
||||
|
||||
client_bin = os.path.join(DIST_DIR, "Win_Client.exe")
|
||||
server_bin = os.path.join(DIST_DIR, "Server.exe")
|
||||
|
||||
Reference in New Issue
Block a user