Skip to content

Commit ba78392

Browse files
committed
Add Windows ZIP build
1 parent c1205c7 commit ba78392

File tree

4 files changed

+62
-25
lines changed

4 files changed

+62
-25
lines changed

.github/workflows/pyinstaller-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
run: pip install .
2222
- name: Build with PyInstaller
2323
# pyinstaller doesn't find the GTK libraries after caching?
24-
run: LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu pyinstaller yafi.spec
24+
run: LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu pyinstaller yafi.spec -- --onefile
2525
working-directory: pyinstaller
2626
- name: Upload PyInstaller Artifact
2727
uses: actions/upload-artifact@v4

.github/workflows/pyinstaller-windows.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
- name: Download GTK4 Gvsbuild zip
2525
if: steps.cache-gtk4.outputs.cache-hit != 'true'
26-
run: Start-BitsTransfer -Source https://github.com/wingtk/gvsbuild/releases/download/2025.8.0/GTK4_Gvsbuild_2025.8.0_x64.zip -Destination Gvsbuild.zip
26+
run: Start-BitsTransfer -Source https://github.com/wingtk/gvsbuild/releases/download/2025.9.0/GTK4_Gvsbuild_2025.9.0_x64.zip -Destination Gvsbuild.zip
2727

2828
- name: Extract Gvsbuild zip
2929
if: steps.cache-gtk4.outputs.cache-hit != 'true'
@@ -41,12 +41,22 @@ jobs:
4141
- name: Build YAFI via Pip
4242
run: pip install .
4343

44-
- name: Build with PyInstaller
44+
- name: Build with PyInstaller (ZIP)
4545
run: python -m PyInstaller yafi.spec
4646
working-directory: pyinstaller
4747

48-
- name: Upload PyInstaller Artifact
48+
- name: Upload PyInstaller Artifact (ZIP)
4949
uses: actions/upload-artifact@v4
5050
with:
51-
path: pyinstaller/dist/YAFI.exe
51+
path: pyinstaller/dist/YAFI/*
5252
name: yafi-windows-${{ github.sha }}
53+
54+
- name: Build with PyInstaller (Standalone)
55+
run: python -m PyInstaller yafi.spec --noconfirm -- --onefile
56+
working-directory: pyinstaller
57+
58+
- name: Upload PyInstaller Artifact (Standalone)
59+
uses: actions/upload-artifact@v4
60+
with:
61+
path: pyinstaller/dist/YAFI.exe
62+
name: yafi-windows-standalone-${{ github.sha }}

pyinstaller/yafi.spec

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
# -*- mode: python ; coding: utf-8 -*-
22
from PyInstaller.utils.hooks import collect_data_files
33
import os
4+
import argparse
5+
6+
parser = argparse.ArgumentParser()
7+
parser.add_argument("--onefile", action="store_true")
8+
options = parser.parse_args()
49

510
datas = [('LpcCrOSEC.bin', '.')] if os.name == 'nt' and os.path.exists('LpcCrOSEC.bin') else []
611
datas += collect_data_files('yafi')
712

8-
913
a = Analysis(
1014
['entrypoint.py'],
1115
pathex=[],
@@ -20,25 +24,35 @@ a = Analysis(
2024
optimize=2,
2125
)
2226
pyz = PYZ(a.pure)
23-
splash = Splash(
24-
'splash.png',
25-
binaries=a.binaries,
26-
datas=a.datas,
27-
text_pos=(4, 480),
28-
# Text doesn't scale on Linux, but does on Windows
29-
text_size=12 if os.name == 'nt' else 6,
30-
minify_script=True,
31-
always_on_top=True,
27+
28+
if options.onefile:
29+
splash = Splash(
30+
'splash.png',
31+
binaries=a.binaries,
32+
datas=a.datas,
33+
text_pos=(4, 480),
34+
# Text doesn't scale on Linux, but does on Windows
35+
text_size=12 if os.name == 'nt' else 6,
36+
minify_script=True,
37+
always_on_top=True,
38+
)
39+
40+
exe_args = (
41+
[
42+
a.scripts,
43+
a.binaries,
44+
a.datas,
45+
splash,
46+
splash.binaries,
47+
]
48+
if options.onefile
49+
else [a.scripts]
3250
)
3351

3452
exe = EXE(
3553
pyz,
36-
a.scripts,
37-
a.binaries,
38-
a.datas,
39-
splash,
40-
splash.binaries,
41-
[],
54+
*exe_args,
55+
exclude_binaries=not options.onefile,
4256
name='YAFI',
4357
debug=False,
4458
bootloader_ignore_signals=False,
@@ -54,3 +68,14 @@ exe = EXE(
5468
entitlements_file=None,
5569
icon=['yafi.ico'],
5670
)
71+
72+
if not options.onefile:
73+
coll = COLLECT(
74+
exe,
75+
a.binaries,
76+
a.datas,
77+
strip=False,
78+
upx=True,
79+
upx_exclude=[],
80+
name='YAFI',
81+
)

yafi/main.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#
1919
# SPDX-License-Identifier: GPL-2.0-or-later
2020

21+
import os
2122
import sys
2223
import traceback
2324
import threading
@@ -67,7 +68,8 @@ def do_activate(self):
6768
self.win = YafiWindow(application=self)
6869

6970
# Update the splash screen
70-
if getattr(sys, 'frozen', False):
71+
splash = getattr(sys, 'frozen', False) and '_PYI_SPLASH_IPC' in os.environ
72+
if splash:
7173
import pyi_splash
7274
pyi_splash.update_text("Detecting EC")
7375

@@ -87,13 +89,13 @@ def do_activate(self):
8789
)
8890
self.show_error("EC Initalisation Error", message)
8991

90-
if getattr(sys, 'frozen', False):
92+
if splash:
9193
pyi_splash.close()
9294

9395
self.win.present()
9496
return
9597

96-
if getattr(sys, 'frozen', False):
98+
if splash:
9799
pyi_splash.update_text("Building Interface")
98100

99101
self.change_page(self.win.content, ThermalsPage())
@@ -123,7 +125,7 @@ def switch_page(page):
123125

124126
self.win.navbar.connect("row-activated", lambda box, row: switch_page(row.get_index()))
125127

126-
if getattr(sys, 'frozen', False):
128+
if splash:
127129
pyi_splash.close()
128130

129131
self.win.present()

0 commit comments

Comments
 (0)