forked from BLKSerene/Wordless
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wl_packaging.spec
203 lines (186 loc) · 6.08 KB
/
wl_packaging.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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
#
# Wordless: Packaging - spec File
#
# Copyright (C) 2018-2021 Ye Lei (叶磊)
#
# This source file is licensed under GNU GPLv3.
# For details, see: https://github.com/BLKSerene/Wordless/blob/master/LICENSE.txt
#
# All other rights reserved.
#
import os
import platform
import sys
import PyInstaller
import pythainlp
block_cipher = None
datas = []
# botok
datas.extend(PyInstaller.utils.hooks.collect_data_files('botok'))
# jieba
datas.extend(PyInstaller.utils.hooks.collect_data_files('jieba'))
# langdetect
datas.extend(PyInstaller.utils.hooks.collect_data_files('langdetect'))
# nagisa
datas.extend(PyInstaller.utils.hooks.collect_data_files('nagisa', include_py_files = True))
# OpenCC
datas.extend(PyInstaller.utils.hooks.collect_data_files('opencc'))
# pkuseg
datas.extend(PyInstaller.utils.hooks.collect_data_files('pkuseg'))
# Python-scfsuite
datas.extend(PyInstaller.utils.hooks.collect_data_files('pycrfsuite', include_py_files = True))
# pymorphy2
datas.extend(PyInstaller.utils.hooks.copy_metadata('pymorphy2_dicts_ru'))
datas.extend(PyInstaller.utils.hooks.copy_metadata('pymorphy2_dicts_uk'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('pymorphy2_dicts_ru'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('pymorphy2_dicts_uk'))
# Pyphen
datas.extend(PyInstaller.utils.hooks.collect_data_files('pyphen'))
# PyThaiNLP
datas.extend(PyInstaller.utils.hooks.collect_data_files('pythainlp'))
# Sacremoses
datas.extend(PyInstaller.utils.hooks.collect_data_files('sacremoses'))
# spaCy
datas.extend(PyInstaller.utils.hooks.collect_data_files('spacy.lang', include_py_files = True))
datas.extend(PyInstaller.utils.hooks.copy_metadata('spacy_lookups_data'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('spacy_lookups_data', include_py_files = True))
datas.extend(PyInstaller.utils.hooks.collect_data_files('spacy_pkuseg'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('ca_core_news_sm'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('zh_core_web_sm'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('da_core_news_sm'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('de_core_news_sm'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('el_core_news_sm'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('en_core_web_sm'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('es_core_news_sm'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('fr_core_news_sm'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('it_core_news_sm'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('lt_core_news_sm'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('mk_core_news_sm'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('nb_core_news_sm'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('nl_core_news_sm'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('pl_core_news_sm'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('pt_core_news_sm'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('ro_core_news_sm'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('ru_core_news_sm'))
# ssg
datas.extend(PyInstaller.utils.hooks.collect_data_files('ssg'))
# TextBlob
datas.extend(PyInstaller.utils.hooks.collect_data_files('textblob'))
# Tokenizer
datas.extend(PyInstaller.utils.hooks.collect_data_files('tokenizer'))
# Underthesea
datas.extend(PyInstaller.utils.hooks.collect_data_files('underthesea'))
# wordcloud
datas.extend(PyInstaller.utils.hooks.collect_data_files('wordcloud'))
# Custom data files
datas.extend([
('src/lemmatization', 'lemmatization'),
('src/stop_word_lists', 'stop_word_lists'),
# Measures
('src/wl_measures/dale_list_easy_words_769.txt', 'wl_measures'),
('src/wl_measures/dale_list_easy_words_3000.txt', 'wl_measures'),
# PyThaiNLP
(pythainlp.tools.get_pythainlp_data_path(), 'pythainlp-data'),
('src/imgs', 'imgs'),
('src/wl_acks.xlsx', '.'),
('src/CHANGELOG.md', '.'),
('src/VERSION', '.'),
('LICENSE.txt', '.')
])
# Data files for macOS
if platform.system() == 'Darwin':
datas.extend(PyInstaller.utils.hooks.collect_data_files('PIL', include_py_files = True))
# Hidden imports
hiddenimports = [
# pymorphy2
'pymorphy2_dicts_ru',
'pymorphy2_dicts_uk',
# spaCy models
'ca_core_news_sm',
'zh_core_web_sm',
'da_core_news_sm',
'de_core_news_sm',
'el_core_news_sm',
'en_core_web_sm',
'es_core_news_sm',
'fr_core_news_sm',
'it_core_news_sm',
'lt_core_news_sm',
'mk_core_news_sm',
'nb_core_news_sm',
'nl_core_news_sm',
'pl_core_news_sm',
'pt_core_news_sm',
'ro_core_news_sm',
'ru_core_news_sm'
]
# Exclusions
if platform.system() in ['Windows', 'Linux']:
excludes = []
elif platform.system() == 'Darwin':
excludes = [
'PIL'
]
# Icons
if platform.system() in ['Windows', 'Linux']:
icon = 'src/imgs/wl_icon.ico'
elif platform.system() == 'Darwin':
icon = 'src/imgs/wl_icon.icns'
a = Analysis(
['src/wl_main.py'],
pathex = [],
binaries = [],
datas = datas,
hiddenimports = hiddenimports,
hookspath = [],
runtime_hooks = [],
excludes = excludes,
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 = 'Wordless',
debug = False,
bootloader_ignore_signals = False,
strip = False,
upx = True,
console = False,
disable_windowed_traceback = False,
target_arch = None,
codesign_identity = None,
entitlements_file = None,
icon = icon
)
# Collect data files
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip = False,
upx = True,
upx_exclude = [],
name = 'Wordless'
)
# Bundle application on macOS
if platform.system() == 'Darwin':
app = BUNDLE(
coll,
name = 'Wordless.app',
icon = icon,
bundle_identifier = None,
info_plist = {
'NSHighResolutionCapable': 'True'
}
)