pyLyricFlow/lyricflow.spec
stan44 e0f298ba36 Add LyricFlow .NET backend API and Python bridge integration
- introduce `LyricFlow.Core.Backend` with shared DTOs, rhyme/spellcheck engines, and REST endpoints
- wire Python GUI/core to run and call the backend via new bridge/client modules
- add backend parity/integration tests and update packaging/ignore settings
2026-03-15 01:44:56 -05:00

119 lines
3.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
datas = []
backend_publish_dir = os.path.join('build', 'publish', 'backend')
if os.path.isdir(backend_publish_dir):
for root, _, files in os.walk(backend_publish_dir):
for file_name in files:
source_path = os.path.join(root, file_name)
relative_root = os.path.relpath(root, backend_publish_dir)
target_root = 'backend' if relative_root == '.' else os.path.join('backend', relative_root)
datas.append((source_path, target_root))
def _candidate_nltk_roots():
roots = []
env_path = os.environ.get('NLTK_DATA')
if env_path:
roots.extend(p for p in env_path.split(os.pathsep) if p)
appdata = os.environ.get('APPDATA')
if appdata:
roots.append(os.path.join(appdata, 'nltk_data'))
home = os.path.expanduser('~')
if home:
roots.append(os.path.join(home, 'nltk_data'))
return roots
for nltk_path in _candidate_nltk_roots():
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')
added_any = False
if os.path.exists(cmudict_path):
datas.append((cmudict_path, 'nltk_data/corpora/cmudict'))
added_any = True
if os.path.exists(cmudict_zip):
datas.append((cmudict_zip, 'nltk_data/corpora'))
added_any = True
if os.path.exists(wordnet_zip):
datas.append((wordnet_zip, 'nltk_data/corpora'))
added_any = True
if added_any:
break
a = Analysis(
['run.py'],
pathex=[os.path.abspath('.')],
binaries=[sip_binary] if sip_binary else [],
datas=datas,
hiddenimports=['PyQt6.sip', 'src.gui.main_window', 'src.gui.backend_runner'],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[
'IPython',
'matplotlib',
'nltk',
'pygame',
'pygame_ce',
'pytest',
'requests',
'sympy',
'tkinter',
'_pytest',
],
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',
)