Skip to content

Commit 04352b9

Browse files
committed
Add Apprise data file handling to macOS workflows
- Updated macOS installer workflows to dynamically include Apprise data files, addressing attachment directory errors. - Enhanced error handling for missing Apprise modules during the build process. - Removed explicit collection of Apprise in the PyInstaller command for a cleaner build process.
1 parent 0badb86 commit 04352b9

File tree

3 files changed

+58
-18
lines changed

3 files changed

+58
-18
lines changed

.github/workflows/macos-installer-arm.yml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -319,17 +319,37 @@ jobs:
319319
320320
block_cipher = None
321321
322+
# Add apprise data files to fix attachment directory error
323+
datas = [
324+
('frontend', 'frontend'),
325+
('version.txt', '.'),
326+
('README.md', '.'),
327+
('LICENSE', '.'),
328+
('src', 'src'),
329+
]
330+
331+
# Add apprise data files
332+
try:
333+
import apprise
334+
apprise_path = os.path.dirname(apprise.__file__)
335+
apprise_attachment_path = os.path.join(apprise_path, 'attachment')
336+
apprise_plugins_path = os.path.join(apprise_path, 'plugins')
337+
apprise_config_path = os.path.join(apprise_path, 'config')
338+
339+
if os.path.exists(apprise_attachment_path):
340+
datas.append((apprise_attachment_path, 'apprise/attachment'))
341+
if os.path.exists(apprise_plugins_path):
342+
datas.append((apprise_plugins_path, 'apprise/plugins'))
343+
if os.path.exists(apprise_config_path):
344+
datas.append((apprise_config_path, 'apprise/config'))
345+
except ImportError:
346+
print("Warning: apprise not found, skipping apprise data files")
347+
322348
a = Analysis(
323349
['app_launcher.py'],
324350
pathex=['.'],
325351
binaries=[],
326-
datas=[
327-
('frontend', 'frontend'),
328-
('version.txt', '.'),
329-
('README.md', '.'),
330-
('LICENSE', '.'),
331-
('src', 'src'),
332-
],
352+
datas=datas,
333353
hiddenimports=[
334354
'flask',
335355
'flask.json',
@@ -426,7 +446,7 @@ jobs:
426446
EOF
427447
428448
- name: Build macOS app bundle
429-
run: python -m PyInstaller Huntarr.spec --clean --collect-all apprise
449+
run: python -m PyInstaller Huntarr.spec --clean
430450

431451
- name: Create PKG installer
432452
run: |

.github/workflows/macos-installer-intel.yml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -317,17 +317,37 @@ jobs:
317317
318318
block_cipher = None
319319
320+
# Add apprise data files to fix attachment directory error
321+
datas = [
322+
('frontend', 'frontend'),
323+
('version.txt', '.'),
324+
('README.md', '.'),
325+
('LICENSE', '.'),
326+
('src', 'src'),
327+
]
328+
329+
# Add apprise data files
330+
try:
331+
import apprise
332+
apprise_path = os.path.dirname(apprise.__file__)
333+
apprise_attachment_path = os.path.join(apprise_path, 'attachment')
334+
apprise_plugins_path = os.path.join(apprise_path, 'plugins')
335+
apprise_config_path = os.path.join(apprise_path, 'config')
336+
337+
if os.path.exists(apprise_attachment_path):
338+
datas.append((apprise_attachment_path, 'apprise/attachment'))
339+
if os.path.exists(apprise_plugins_path):
340+
datas.append((apprise_plugins_path, 'apprise/plugins'))
341+
if os.path.exists(apprise_config_path):
342+
datas.append((apprise_config_path, 'apprise/config'))
343+
except ImportError:
344+
print("Warning: apprise not found, skipping apprise data files")
345+
320346
a = Analysis(
321347
['app_launcher.py'],
322348
pathex=['.'],
323349
binaries=[],
324-
datas=[
325-
('frontend', 'frontend'),
326-
('version.txt', '.'),
327-
('README.md', '.'),
328-
('LICENSE', '.'),
329-
('src', 'src'),
330-
],
350+
datas=datas,
331351
hiddenimports=[
332352
'flask',
333353
'flask.json',
@@ -426,7 +446,7 @@ jobs:
426446
- name: Build macOS app bundle
427447
run: |
428448
# Force x86_64 architecture for Intel build
429-
arch -x86_64 python -m PyInstaller Huntarr.spec --clean --collect-all apprise
449+
arch -x86_64 python -m PyInstaller Huntarr.spec --clean
430450
431451
- name: Verify architecture
432452
run: |

.github/workflows/windows-build-nsis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ jobs:
6565
python -m pip install -r requirements.txt
6666
python -m pip install pywin32
6767
68-
# Build with apprise support - use --collect-all apprise to fix attachment directory error
69-
pyinstaller -y --collect-all apprise distribution/windows/huntarr.spec
68+
# Build with apprise support (apprise data files are included in the spec file)
69+
pyinstaller -y distribution/windows/huntarr.spec
7070
7171
# Display contents of dist/Huntarr
7272
dir dist/Huntarr

0 commit comments

Comments
 (0)