-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdesktop.spec
149 lines (128 loc) · 3.39 KB
/
desktop.spec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# -*- mode: python -*-
import os
import sys
sys.path+=['.']
from kivy.tools.packaging.pyinstaller_hooks import get_deps_minimal, hookspath, runtime_hooks
from PyInstaller.utils.hooks import collect_submodules
# This setting must match with setting of environment in main.py file
# View more on https://kivy.org/doc/stable/api-kivy.tools.packaging.pyinstaller_hooks.html#kivy.tools.packaging.pyinstaller_hooks.get_deps_minimal
kivy_core = {
'window': True,
'clipboard': True,
'image': True,
'text': True,
'video': 'null',
'audio': None,
# 'audio': ['sdl2'],
'camera': None,
'spelling': None,
}
if sys.platform == 'win32':
from kivy.deps import sdl2, glew
deps = [Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)]
hiddenimports = []
binaries = []
excludes = []
datas = []
if kivy_core['camera']:
kivy_core['camera'] = 'opencv'
elif sys.platform == 'darwin':
deps = []
hiddenimports = []
binaries = []
excludes = []
datas = []
if kivy_core['camera']:
kivy_core['camera'] = 'avfoundation'
if kivy_core['audio']:
kivy_core['audio'].append('avplayer')
else:
raise RuntimeError(
"This build spec doesn't support your platform.\n"
"But it can also run well if you add some config for your target platform."
)
hiddenimports += [
'kivy.weakmethod', # I don't know why pyinstaller forgot to include it
]
hiddenimports += collect_submodules('av')
excludes += [
'lib2to3',
'docutils', # Uncomment this if you use RstDocument
# 'numpy', # Include because of camera android, picamera ?
]
# ffpyplayer always includes for some reason
if not kivy_core['video'] or kivy_core['video'] == 'null':
excludes.append('ffpyplayer')
datas += [
('./kivyrtc/data','kivyrtc/data'),
('./kivyrtc/*.kv', 'kivyrtc'),
('./kivyrtc/tools/*.kv', 'kivyrtc/tools'),
('./kivyrtc/uix/*.kv', 'kivyrtc/uix'),
]
# Get config generated by kivy
extra = get_deps_minimal(**kivy_core)
for i in excludes:
extra['excludes'] += collect_submodules(i)
extra['hiddenimports'] += hiddenimports
# Kivy before v1.10.1, not have key 'binaries'
if extra.get('binaries'):
extra['binaries'] += binaries
else:
extra['binaries'] = binaries
# Embedde kivy file into python file
# from buildtools import embedde_kivy_file
# pathex = [embedde_kivy_file('block')]
pathex = ['.']
block_cipher = None
a = Analysis(
['main.py'],
pathex=pathex,
datas=datas,
hookspath=hookspath(),
runtime_hooks=runtime_hooks(),
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
**extra
)
pyz = PYZ(
a.pure,
a.zipped_data,
cipher=block_cipher
)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='Kivy RTC',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
icon='./kivyrtc/data/icon.ico',
console=False
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
*deps,
icon='./kivyrtc/data/icon.ico',
strip=False,
upx=True,
name='Kivy RTC'
)
if sys.platform == 'darwin':
app = BUNDLE(
coll,
name='Kivy RTC.app',
icon='./kivyrtc/data/icon.icns',
bundle_identifier=None,
info_plist={
'NSPrincipleClass': 'NSApplication',
'NSHighResolutionCapable': True,
},
)