patch dmg
This commit is contained in:
1 parent
e147f368cd
commit
c89c244cb0
3 files changed
+115
No files matched your search
@@ -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"
|
||||
|
||||
|
||||
@@ -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',
|
||||
]
|
||||
@@ -0,0 +1,51 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
from PyInstaller.utils.hooks import collect_all
|
||||
|
||||
datas = []
|
||||
binaries = []
|
||||
hiddenimports = []
|
||||
tmp_ret = collect_all('kivymd')
|
||||
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
|
||||
|
||||
|
||||
a = Analysis(
|
||||
['katrain/__main__.py'],
|
||||
pathex=[],
|
||||
binaries=binaries,
|
||||
datas=datas,
|
||||
hiddenimports=hiddenimports,
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=['ffpyplayer', 'pygame'],
|
||||
noarchive=False,
|
||||
optimize=0,
|
||||
)
|
||||
pyz = PYZ(a.pure)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
[],
|
||||
exclude_binaries=True,
|
||||
name='test_katrain',
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
console=True,
|
||||
disable_windowed_traceback=False,
|
||||
argv_emulation=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
)
|
||||
coll = COLLECT(
|
||||
exe,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
strip=False,
|
||||
upx=True,
|
||||
upx_exclude=[],
|
||||
name='test_katrain',
|
||||
)
|
||||
Reference in new issue
Block a user