-
Notifications
You must be signed in to change notification settings - Fork 235
Expand file tree
/
Copy pathosx-binary.spec
More file actions
106 lines (93 loc) · 4.17 KB
/
Copy pathosx-binary.spec
File metadata and controls
106 lines (93 loc) · 4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# -*- mode: python ; coding: utf-8 -*-
import os
from hiddenimports import hiddenimports
from ledfx.consts import PROJECT_VERSION
from PyInstaller.utils.hooks import collect_dynamic_libs, collect_data_files, collect_submodules, copy_metadata
spec_root = os.path.abspath(SPECPATH)
venv_root = os.path.abspath(os.path.join(SPECPATH, '..'))
block_cipher = None
# Collect NumPy binaries and data files (required for NumPy 2.x)
numpy_binaries = collect_dynamic_libs('numpy')
numpy_datas = collect_data_files('numpy', include_py_files=True)
numpy_hiddenimports = collect_submodules('numpy')
# Collect pyFLAC native libraries (libFLAC.dylib must be bundled alongside the .so files)
pyflac_binaries = collect_dynamic_libs('pyflac')
# Collect lifx-async package metadata (required by lifx/__init__.py for importlib.metadata)
lifx_metadata = copy_metadata('lifx-async')
# Remove the ledfx.env file if it exists
os.remove("ledfx.env") if os.path.exists("ledfx.env") else None
# Collect ledfx_assets excluding animated_frames source PNGs
import glob
ledfx_assets_datas = []
for filepath in glob.glob(f'{spec_root}/ledfx_assets/**/*', recursive=True):
if os.path.isfile(filepath) and 'animated_frames' not in filepath:
rel_dir = os.path.relpath(os.path.dirname(filepath), spec_root)
ledfx_assets_datas.append((filepath, rel_dir))
# Get environment variables
github_ref = os.getenv('GITHUB_REF')
github_sha_value = os.getenv('GITHUB_SHA')
# Initialize variables
variables = [f"GITHUB_SHA = {github_sha_value}"]
SHOW_CONSOLE = True
# Check if this is a release
if github_ref and 'refs/tags/' in github_ref:
# cleanup github_ref to remove /refs/tags/v and leave just the version
github_ref_cleaned = github_ref.replace('refs/tags/v', '')
assert PROJECT_VERSION == github_ref_cleaned, "Version and Tag do not match - aborting release."
variables.append('IS_RELEASE = true')
SHOW_CONSOLE = False
else:
variables.append('IS_RELEASE = false')
# Write to ledfx.env file
with open('ledfx.env', 'a') as file:
file.write('\n'.join(variables))
a = Analysis([f'{spec_root}/ledfx/__main__.py'],
pathex=[f'{spec_root}', f'{spec_root}/ledfx'],
binaries=numpy_binaries + pyflac_binaries,
datas=[(f'{spec_root}/ledfx_frontend', 'ledfx_frontend/'), (f'{spec_root}/ledfx/', 'ledfx/'), (f'{spec_root}/ledfx_assets/tray.png','.'), (f'{spec_root}/ledfx.env','.')] + ledfx_assets_datas + numpy_datas + lifx_metadata,
hiddenimports=hiddenimports + numpy_hiddenimports,
hookspath=[f'{venv_root}/lib/site-packages/pyupdater/hooks'],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='LedFx',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=SHOW_CONSOLE,
icon=f'{spec_root}/ledfx_assets/discord.ico')
app = BUNDLE(exe,
a.binaries,
a.zipfiles,
a.datas,
name='LedFx',
icon=f'{spec_root}/ledfx_assets/logo.icns',
bundle_identifier='com.ledfx.ledfx',
version=f'{PROJECT_VERSION}',
info_plist={
'CFBundleShortVersionString': f'{PROJECT_VERSION}',
'CFBundleVersion': f'{PROJECT_VERSION}',
'LSApplicationCategoryType': 'public.app-category.music',
'NSHumanReadableCopyright': 'Copyright © 2024 LedFx Developers',
'NSPrincipalClass': 'NSApplication',
'NSAppleScriptEnabled': False,
'NSMicrophoneUsageDescription': 'LedFx uses audio for sound visualization',
'com.apple.security.device.audio-input': True,
'com.apple.security.device.microphone': True,
},
entitlements_plist={
'com.apple.security.device.audio-input': True,
'com.apple.security.device.microphone': True,
})
# Cleanup ledfx.env
os.remove("ledfx.env")