Hopefully improve the .spec file to copy files in place and not open a console window.

This commit is contained in:
Storm Dragon
2025-11-03 20:55:15 -05:00
parent 64a5546a55
commit 54040d2669

View File

@@ -1,11 +1,18 @@
# -*- mode: python ; coding: utf-8 -*- # -*- mode: python ; coding: utf-8 -*-
import shutil
from pathlib import Path
a = Analysis( a = Analysis(
['Toby Doom Launcher.py'], ['Toby Doom Launcher.py'],
pathex=[], pathex=[],
binaries=[], binaries=[],
datas=[], datas=[
('TobyCustom', 'TobyCustom'),
('DoomTTS.ps1', '.'),
('LICENSE', '.'),
('README.md', '.'),
],
hiddenimports=[], hiddenimports=[],
hookspath=[], hookspath=[],
hooksconfig={}, hooksconfig={},
@@ -26,7 +33,7 @@ exe = EXE(
bootloader_ignore_signals=False, bootloader_ignore_signals=False,
strip=False, strip=False,
upx=True, upx=True,
console=True, console=False,
disable_windowed_traceback=False, disable_windowed_traceback=False,
argv_emulation=False, argv_emulation=False,
target_arch=None, target_arch=None,
@@ -42,3 +49,29 @@ coll = COLLECT(
upx_exclude=[], upx_exclude=[],
name='Toby Doom Launcher', name='Toby Doom Launcher',
) )
# Post-build hook: Copy nvdaControllerClient.dll to _internal and copy/rename docs
build_dir = Path('build') / 'Toby Doom Launcher'
internal_dir = build_dir / '_internal'
# Copy NVDA DLL to _internal
nvda_dll_source = Path('nvdaControllerClient.dll')
nvda_dll_dest = internal_dir / 'nvdaControllerClient.dll'
if nvda_dll_source.exists() and internal_dir.exists():
shutil.copy2(str(nvda_dll_source), str(nvda_dll_dest))
print('✓ Copied nvdaControllerClient.dll to build/Toby Doom Launcher/_internal/')
# Copy and rename LICENSE file
license_source = Path('LICENSE')
license_dest = build_dir / 'toby-doom-launcher_LICENSE.txt'
if license_source.exists() and build_dir.exists():
shutil.copy2(str(license_source), str(license_dest))
print('✓ Copied LICENSE to build/Toby Doom Launcher/toby-doom-launcher_LICENSE.txt')
# Copy and rename README file
readme_source = Path('README.md')
readme_dest = build_dir / 'toby-doom-launcher_README.md'
if readme_source.exists() and build_dir.exists():
shutil.copy2(str(readme_source), str(readme_dest))
print('✓ Copied README.md to build/Toby Doom Launcher/toby-doom-launcher_README.md')