Skip to content

Commit a470c80

Browse files
committed
[Fix]: added missing hidden import for linux and mac
1 parent 2bd96cb commit a470c80

2 files changed

Lines changed: 24 additions & 1 deletion

File tree

.github/workflows/build-release.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ jobs:
3636
- name: Build executable (macOS/Linux)
3737
if: runner.os != 'Windows'
3838
run: |
39-
pyinstaller --onefile --windowed --name PyGong --add-data "gongs:gongs" interval_timer.py
39+
pyinstaller --onefile --windowed --name PyGong --add-data "gongs:gongs" \
40+
--hidden-import=PyQt6.QtCore \
41+
--hidden-import=PyQt6.QtGui \
42+
--hidden-import=PyQt6.QtWidgets \
43+
--hidden-import=PyQt6.QtMultimedia \
44+
--collect-all PyQt6 \
45+
interval_timer.py
4046
4147
- name: Rename Linux executable
4248
if: runner.os == 'Linux'

interval_timer.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,25 @@
1010
- Controller: pygong/controller.py
1111
"""
1212

13+
import os
1314
import sys
1415

16+
# Ensure Qt platform plugins can be found in bundled executables (Linux/macOS)
17+
if hasattr(sys, 'frozen') and sys.platform in ('linux', 'darwin'):
18+
base_dir = os.path.dirname(sys.executable)
19+
20+
# Try multiple possible plugin paths
21+
possible_plugin_paths = [
22+
os.path.join(base_dir, 'PyQt6', 'plugins'), # Direct path
23+
os.path.join(base_dir, '..', '_internal', 'PyQt6', 'plugins'), # PyInstaller internal
24+
os.path.join(base_dir, 'lib', 'PyQt6', 'plugins'), # Alternative structure
25+
]
26+
27+
for plugins_dir in possible_plugin_paths:
28+
if os.path.isdir(plugins_dir):
29+
os.environ.setdefault('QT_QPA_PLATFORM_PLUGIN_PATH', plugins_dir)
30+
break
31+
1532
from PyQt6.QtWidgets import QApplication
1633

1734
from pygong.controller import IntervalTimerController

0 commit comments

Comments
 (0)