patch dmg

This commit is contained in:
Sander Land authored and GitHub committed 2025-06-12 10:44:41 +02:00
1 parent e147f368cd
commit c89c244cb0
3 files changed
+115

No files matched your search

+9
View File
@@ -53,6 +53,8 @@ datas = [
(f"{base_path}/KataGo", "katrain/KataGo"),
]
# KivyMD data files will be handled by the custom hook
# Platform-specific binaries
binaries = kivy_deps.get('binaries', [])
if is_macos:
@@ -71,11 +73,18 @@ if is_windows:
# Platform-specific hooks and excludes
hookspath = kivy_deps.get('hookspath', [])
hookspath.append(kivymd_hooks_path)
# Add custom KivyMD hook directory
hookspath.append(SPECPATH)
# Exclude problematic modules
excludes = kivy_deps.get('excludes', []) + ["scipy", "pandas", "numpy", "matplotlib", "docutils"]
if is_windows:
excludes.append("mkl")
# Fix SDL2 conflicts on macOS by excluding ffpyplayer
if is_macos:
excludes.extend(["ffpyplayer", "pygame"])
# Entry point - relative to spec file location
entry_point = f"{base_path}/__main__.py"
+55
View File
@@ -0,0 +1,55 @@
from PyInstaller.utils.hooks import collect_data_files, get_package_paths
import os
# Collect all KivyMD data files
datas = collect_data_files('kivymd')
# Add specific KivyMD paths
kivymd_path = get_package_paths('kivymd')[1]
# Ensure KivyMD directories are included
kivymd_data_dirs = ['fonts', 'images', 'uix']
for data_dir in kivymd_data_dirs:
dir_path = os.path.join(kivymd_path, data_dir)
if os.path.exists(dir_path):
datas.append((dir_path, f'kivymd/{data_dir}'))
# Create missing .kv files for KivyMD components
# This is a workaround for KivyMD 1.2.0 missing .kv files
missing_kv_files = {
'kivymd/uix/label/label.kv': '''
<MDLabel>:
disabled_color: self.theme_cls.disabled_hint_text_color
text_size: self.size
''',
'kivymd/uix/button/button.kv': '''
<MDButton>:
disabled_color: self.theme_cls.disabled_hint_text_color
''',
'kivymd/uix/textfield/textfield.kv': '''
<MDTextField>:
disabled_color: self.theme_cls.disabled_hint_text_color
''',
}
# Add the missing .kv files to datas
import tempfile
import shutil
temp_dir = tempfile.mkdtemp()
for kv_path, kv_content in missing_kv_files.items():
full_temp_path = os.path.join(temp_dir, kv_path)
os.makedirs(os.path.dirname(full_temp_path), exist_ok=True)
with open(full_temp_path, 'w') as f:
f.write(kv_content)
datas.append((full_temp_path, kv_path))
# Hidden imports for KivyMD
hiddenimports = [
'kivymd.icon_definitions',
'kivymd.font_definitions',
'kivymd.color_definitions',
'kivymd.uix.label.label',
'kivymd.uix.button.button',
'kivymd.uix.textfield.textfield',
]