89 lines
2.1 KiB
Python
89 lines
2.1 KiB
Python
# -*- mode: python ; coding: utf-8 -*-
|
|
import os
|
|
import sys
|
|
from importlib.machinery import EXTENSION_SUFFIXES
|
|
|
|
block_cipher = None
|
|
|
|
# Find PyQt6 sip binary manually
|
|
import PyQt6
|
|
pyqt6_path = os.path.dirname(PyQt6.__file__)
|
|
sip_binary = None
|
|
for f in os.listdir(pyqt6_path):
|
|
if f.startswith('sip') and any(f.endswith(suffix) for suffix in EXTENSION_SUFFIXES):
|
|
sip_binary = (os.path.join(pyqt6_path, f), 'PyQt6')
|
|
break
|
|
|
|
# Get NLTK data path from environment or default locations
|
|
import nltk
|
|
nltk_data_paths = nltk.data.path
|
|
nltk_path = None
|
|
for p in nltk_data_paths:
|
|
if os.path.exists(p):
|
|
nltk_path = p
|
|
break
|
|
|
|
datas = [
|
|
('src', 'src'),
|
|
('assets', 'assets'),
|
|
('data', 'data'),
|
|
]
|
|
|
|
if nltk_path:
|
|
cmudict_path = os.path.join(nltk_path, 'corpora', 'cmudict')
|
|
cmudict_zip = os.path.join(nltk_path, 'corpora', 'cmudict.zip')
|
|
wordnet_zip = os.path.join(nltk_path, 'corpora', 'wordnet.zip')
|
|
if os.path.exists(cmudict_path):
|
|
datas.append((cmudict_path, 'nltk_data/corpora/cmudict'))
|
|
if os.path.exists(cmudict_zip):
|
|
datas.append((cmudict_zip, 'nltk_data/corpora'))
|
|
if os.path.exists(wordnet_zip):
|
|
datas.append((wordnet_zip, 'nltk_data/corpora'))
|
|
|
|
a = Analysis(
|
|
['run.py'],
|
|
pathex=[os.path.abspath('src')],
|
|
binaries=[sip_binary] if sip_binary else [],
|
|
datas=datas,
|
|
hiddenimports=['PyQt6.sip', 'nltk.corpus.wordnet', 'nltk.corpus.cmudict'],
|
|
hookspath=[],
|
|
hooksconfig={},
|
|
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='LyricFlow',
|
|
debug=False,
|
|
bootloader_ignore_signals=False,
|
|
strip=False,
|
|
upx=True,
|
|
console=False,
|
|
disable_windowed_traceback=False,
|
|
argv_emulation=False,
|
|
target_arch=None,
|
|
codesign_identity=None,
|
|
entitlements_file=None,
|
|
)
|
|
|
|
coll = COLLECT(
|
|
exe,
|
|
a.binaries,
|
|
a.zipfiles,
|
|
a.datas,
|
|
strip=False,
|
|
upx=True,
|
|
upx_exclude=[],
|
|
name='LyricFlow',
|
|
)
|