Skip to content

Commit 3f0420b

Browse files
committed
imported some fixes to pyinstaller
Commited fixes suggested in original PR, namely: - Updated dependencies to make this work on current MacOS. - Added call to freeze_support() as mentioned in https://pyinstaller.org/en/stable/common-issues-and-pitfalls.html#multi-processing - Added missing backslash in comment
1 parent c37b711 commit 3f0420b

6 files changed

Lines changed: 31 additions & 21 deletions

File tree

.github/workflows/main.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ jobs:
1919
run: |
2020
apt-get update
2121
apt-get install -y lsb-release libusb-1.0-0-dev libudev-dev ruby ruby-dev rubygems build-essential desktop-file-utils wget unzip zlib1g-dev liblzma-dev libssl-dev git imagemagick file libfuse2
22-
wget -c $(wget -q https://api.github.com/repos/AppImageCommunity/pkg2appimage/releases -O - | grep "pkg2appimage-.*-x86_64.AppImage" | grep browser_download_url | head -n 1 | cut -d '"' -f 4)
23-
chmod +x ./pkg2appimage-*.AppImage
24-
gem install --no-document fpm
22+
wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage
23+
chmod +x ./appimagetool-x86_64.AppImage
2524
2625
- uses: actions/setup-python@v5
2726
with:
@@ -41,8 +40,7 @@ jobs:
4140
cp src/main/icons/linux/1024.png dist/Vial/Vial.png
4241
cp misc/Vial.desktop dist/Vial/
4342
cp misc/AppRun dist/Vial/
44-
./pkg2appimage-*.AppImage --appdir dist/Vial --output appimage
45-
mv Vial-*-x86_64.AppImage Vial-x86_64.AppImage
43+
./appimagetool-x86_64.AppImage dist/Vial
4644
4745
- uses: actions/upload-artifact@v4
4846
with:
@@ -71,7 +69,7 @@ jobs:
7169
run: |
7270
. venv/bin/activate
7371
pyinstaller misc/Vial.spec
74-
hdiutil create -volname Vial -srcfolder "target/Vial.app" -ov -format UDZO vial-mac.dmg
72+
hdiutil create -volname Vial -srcfolder "dist/Vial.app" -ov -format UDZO vial-mac.dmg
7573
7674
- uses: actions/upload-artifact@v4
7775
with:
@@ -119,4 +117,4 @@ jobs:
119117
- uses: actions/upload-artifact@v4
120118
with:
121119
name: vial-win-installer
122-
path: target\VialSetup.exe
120+
path: VialSetup.exe

misc/README.pyinstaller.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pyi-makespec \
1212
--add-data="../src/build/settings/mac.json:resources/settings" \
1313
--windowed \
1414
--noupx \
15-
--icon="../src/main/icons/Icon.ico"
15+
--icon="../src/main/icons/Icon.ico" \
1616
--argv-emulation \
1717
./src/main/python/main.py
1818
```

misc/Vial.spec

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ exe = EXE(
2525
bootloader_ignore_signals=False,
2626
strip=False,
2727
upx=False,
28-
console=True,
28+
console=False,
2929
disable_windowed_traceback=False,
3030
argv_emulation=True,
3131
target_arch=None,
@@ -42,3 +42,9 @@ coll = COLLECT(
4242
upx_exclude=[],
4343
name='Vial',
4444
)
45+
app = BUNDLE(
46+
coll,
47+
name='Vial.app',
48+
icon='../src/main/icons/Icon.ico',
49+
bundle_identifier=None
50+
)

requirements.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
altgraph==0.17.4
22
certifi==2024.2.2
33
future==1.0.0
4-
hidapi==0.14.0
4+
hidapi==0.14.0.post4
55
keyboard==0.13.5
66
macholib==1.14
77
packaging==24.0
88
pefile==2023.2.7
9-
pyinstaller==6.5.0
10-
pyinstaller-hooks-contrib==2024.3
11-
PyQt5==5.15.7
12-
PyQt5-Qt5==5.15.2
13-
PyQt5-sip==12.13.0
9+
pillow==11.1.0
10+
pyinstaller==6.12.0
11+
pyinstaller-hooks-contrib==2025.1
12+
PyQt5==5.15.11
13+
PyQt5-sip==12.17.0
1414
pywin32==306; sys_platform == 'win32'
1515
pywin32-ctypes==0.2.2
1616
setuptools==69.2.0

src/installer/windows/Installer.nsi

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
!include MUI2.nsh
22
!include FileFunc.nsh
33

4+
!define app_name "Vial"
5+
!define author "Vial KB"
6+
47
;--------------------------------
58
;Perform Machine-level install, if possible
69

@@ -31,7 +34,7 @@ FunctionEnd
3134
;General
3235

3336
Name "${app_name}"
34-
OutFile "..\${installer}"
37+
OutFile "..\..\..\VialSetup.exe"
3538

3639
;--------------------------------
3740
;Interface Settings
@@ -49,7 +52,7 @@ FunctionEnd
4952
!define MUI_FINISHPAGE_RUN
5053
!define MUI_FINISHPAGE_RUN_CHECKED
5154
!define MUI_FINISHPAGE_RUN_TEXT "Run ${app_name}"
52-
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchLink"
55+
!define MUI_FINISHPAGE_RUN_FUNCTION "LaunchAsNonAdmin"
5356
!insertmacro MUI_PAGE_FINISH
5457

5558
!insertmacro MUI_UNPAGE_CONFIRM
@@ -67,7 +70,7 @@ FunctionEnd
6770
"Software\Microsoft\Windows\CurrentVersion\Uninstall\${app_name}"
6871
Section
6972
SetOutPath "$InstDir"
70-
File /r "..\${app_name}\*"
73+
File /r "..\..\..\dist\${app_name}\*"
7174
WriteRegStr SHCTX "Software\${app_name}" "" $InstDir
7275
WriteUninstaller "$InstDir\uninstall.exe"
7376
CreateShortCut "$SMPROGRAMS\${app_name}.lnk" "$InstDir\${app_name}.exe"
@@ -99,7 +102,6 @@ Section "Uninstall"
99102

100103
SectionEnd
101104

102-
Function LaunchLink
103-
!addplugindir "."
104-
ShellExecAsUser::ShellExecAsUser "open" "$SMPROGRAMS\${app_name}.lnk"
105+
Function LaunchAsNonAdmin
106+
Exec '"$WINDIR\explorer.exe" "$InstDir\${app_name}.exe"'
105107
FunctionEnd

src/main/python/main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from functools import cached_property
33
from glob import glob
44
import json
5+
from multiprocessing import freeze_support
56
import os
67
from os import path
78
import ssl
@@ -107,6 +108,9 @@ def get_resource(self, file_name):
107108

108109

109110
if __name__ == '__main__':
111+
# https://pyinstaller.org/en/stable/common-issues-and-pitfalls.html#multi-processing
112+
freeze_support()
113+
110114
if len(sys.argv) == 2 and sys.argv[1] == "--linux-recorder":
111115
from linux_keystroke_recorder import linux_keystroke_recorder
112116

0 commit comments

Comments
 (0)