Add Windows ZIP build

This commit is contained in:
Stephen Horvath
2025-09-18 15:03:30 +10:00
parent c1205c7661
commit ba78392b24
4 changed files with 62 additions and 25 deletions

View File

@@ -21,7 +21,7 @@ jobs:
run: pip install .
- name: Build with PyInstaller
# pyinstaller doesn't find the GTK libraries after caching?
run: LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu pyinstaller yafi.spec
run: LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu pyinstaller yafi.spec -- --onefile
working-directory: pyinstaller
- name: Upload PyInstaller Artifact
uses: actions/upload-artifact@v4

View File

@@ -23,7 +23,7 @@ jobs:
- name: Download GTK4 Gvsbuild zip
if: steps.cache-gtk4.outputs.cache-hit != 'true'
run: Start-BitsTransfer -Source https://github.com/wingtk/gvsbuild/releases/download/2025.8.0/GTK4_Gvsbuild_2025.8.0_x64.zip -Destination Gvsbuild.zip
run: Start-BitsTransfer -Source https://github.com/wingtk/gvsbuild/releases/download/2025.9.0/GTK4_Gvsbuild_2025.9.0_x64.zip -Destination Gvsbuild.zip
- name: Extract Gvsbuild zip
if: steps.cache-gtk4.outputs.cache-hit != 'true'
@@ -41,12 +41,22 @@ jobs:
- name: Build YAFI via Pip
run: pip install .
- name: Build with PyInstaller
- name: Build with PyInstaller (ZIP)
run: python -m PyInstaller yafi.spec
working-directory: pyinstaller
- name: Upload PyInstaller Artifact
- name: Upload PyInstaller Artifact (ZIP)
uses: actions/upload-artifact@v4
with:
path: pyinstaller/dist/YAFI/*
name: yafi-windows-${{ github.sha }}
- name: Build with PyInstaller (Standalone)
run: python -m PyInstaller yafi.spec --noconfirm -- --onefile
working-directory: pyinstaller
- name: Upload PyInstaller Artifact (Standalone)
uses: actions/upload-artifact@v4
with:
path: pyinstaller/dist/YAFI.exe
name: yafi-windows-${{ github.sha }}
name: yafi-windows-standalone-${{ github.sha }}

View File

@@ -1,11 +1,15 @@
# -*- mode: python ; coding: utf-8 -*-
from PyInstaller.utils.hooks import collect_data_files
import os
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--onefile", action="store_true")
options = parser.parse_args()
datas = [('LpcCrOSEC.bin', '.')] if os.name == 'nt' and os.path.exists('LpcCrOSEC.bin') else []
datas += collect_data_files('yafi')
a = Analysis(
['entrypoint.py'],
pathex=[],
@@ -20,7 +24,9 @@ a = Analysis(
optimize=2,
)
pyz = PYZ(a.pure)
splash = Splash(
if options.onefile:
splash = Splash(
'splash.png',
binaries=a.binaries,
datas=a.datas,
@@ -29,16 +35,24 @@ splash = Splash(
text_size=12 if os.name == 'nt' else 6,
minify_script=True,
always_on_top=True,
)
)
exe = EXE(
pyz,
exe_args = (
[
a.scripts,
a.binaries,
a.datas,
splash,
splash.binaries,
[],
]
if options.onefile
else [a.scripts]
)
exe = EXE(
pyz,
*exe_args,
exclude_binaries=not options.onefile,
name='YAFI',
debug=False,
bootloader_ignore_signals=False,
@@ -54,3 +68,14 @@ exe = EXE(
entitlements_file=None,
icon=['yafi.ico'],
)
if not options.onefile:
coll = COLLECT(
exe,
a.binaries,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='YAFI',
)

View File

@@ -18,6 +18,7 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later
import os
import sys
import traceback
import threading
@@ -67,7 +68,8 @@ class YafiApplication(Adw.Application):
self.win = YafiWindow(application=self)
# Update the splash screen
if getattr(sys, 'frozen', False):
splash = getattr(sys, 'frozen', False) and '_PYI_SPLASH_IPC' in os.environ
if splash:
import pyi_splash
pyi_splash.update_text("Detecting EC")
@@ -87,13 +89,13 @@ class YafiApplication(Adw.Application):
)
self.show_error("EC Initalisation Error", message)
if getattr(sys, 'frozen', False):
if splash:
pyi_splash.close()
self.win.present()
return
if getattr(sys, 'frozen', False):
if splash:
pyi_splash.update_text("Building Interface")
self.change_page(self.win.content, ThermalsPage())
@@ -123,7 +125,7 @@ class YafiApplication(Adw.Application):
self.win.navbar.connect("row-activated", lambda box, row: switch_page(row.get_index()))
if getattr(sys, 'frozen', False):
if splash:
pyi_splash.close()
self.win.present()