-
Notifications
You must be signed in to change notification settings - Fork 14
/
setup.py
300 lines (281 loc) · 5.53 KB
/
setup.py
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# -*- coding: utf-8 -*-
"""Setup info for building AYON Desktop application."""
import os
import platform
from pathlib import Path
from cx_Freeze import setup, Executable
ayon_root = Path(os.path.dirname(__file__))
resources_dir = ayon_root / "common" / "ayon_common" / "resources"
version_content = {}
with open(ayon_root / "version.py") as fp:
exec(fp.read(), version_content)
__version__ = version_content["__version__"]
low_platform_name = platform.system().lower()
IS_WINDOWS = low_platform_name == "windows"
IS_LINUX = low_platform_name == "linux"
IS_MACOS = low_platform_name == "darwin"
base = None
if IS_WINDOWS:
base = "Win32GUI"
# -----------------------------------------------------------------------
# build_exe
# Build options for cx_Freeze. Manually add/exclude packages and binaries
install_requires = [
"appdirs",
"cx_Freeze",
"keyring",
"pkg_resources",
"qtpy",
"filecmp",
"dns",
# Python defaults (cx_Freeze skip some of them because are unused)
"colorsys",
"dbm",
"dataclasses",
"email.mime.application",
"email.mime.audio",
"email.mime.base",
"email.mime.image",
"email.mime.message",
"email.mime.multipart",
"email.mime.nonmultipart",
"email.mime.text",
"sqlite3",
"timeit",
]
# These are added just to be sure created executable has available even
# unused modules. Some of them are not available on all platforms.
python_builtins = [
# Just to be sure
"abc",
"argparse",
"asyncio",
"base64",
"cmd",
"code",
"codecs",
"codeop",
"collections",
"compileall",
"configparser",
"concurrent",
"contextlib",
"contextvars",
"copy",
"csv",
"ctypes",
"curses",
"distutils",
"datetime",
"decimal",
"difflib",
"dis",
"email",
"encodings",
"ensurepip",
"enum",
"filecmp",
"fileinput",
"fnmatch",
"formatter",
"fractions",
"ftplib",
"functools",
"genericpath",
"getopt",
"getpass",
"gettext",
"glob",
"graphlib",
"gzip",
"hashlib",
"heapq",
"hmac",
"html",
"http",
"idlelib",
"imaplib",
"imghdr",
"importlib",
"inspect",
"io",
"ipaddress",
"json",
"keyword",
"linecache",
"locale",
"logging",
"lzma",
"mailbox",
"mailcap",
"mimetypes",
"modulefinder",
"multiprocessing",
"netrc",
"nntplib",
"numbers",
"opcode",
"operator",
"optparse",
"os",
"pathlib",
"pdb",
"pickle",
"pickletools",
"pipes",
"pkgutil",
"platform",
"plistlib",
"poplib",
"posixpath",
"pprint",
"profile",
"pstats",
"pty",
"py_compile",
"pyclbr",
"pydoc",
"queue",
"quopri",
"random",
"re",
"reprlib",
"rlcompleter",
"runpy",
"sched",
"secrets",
"selectors",
"shelve",
"shlex",
"shutil",
"signal",
"smtpd",
"smtplib",
"sndhdr",
"socket",
"socketserver",
"sre_compile",
"sre_constants",
"sre_parse",
"ssl",
"stat",
"statistics",
"string",
"stringprep",
"struct",
"subprocess",
"sunau",
"symbol",
"symtable",
"tarfile",
"telnetlib",
"tempfile",
"textwrap",
"threading",
"token",
"tokenize",
"trace",
"traceback",
"tracemalloc",
"turtle",
"types",
"typing",
"uuid",
"urllib",
"warnings",
"wave",
"weakref",
"webbrowser",
"xml",
"zipapp",
"zipfile",
"zipimport",
"zoneinfo",
]
for module_name in python_builtins:
try:
__import__(module_name)
install_requires.append(module_name)
except ImportError:
pass
includes = []
excludes = [
# Make sure 'common' subfolder is not included in 'lib'
# - can happen when there are testing imports like:
# 'from common.ayon_common import ...'
"common",
]
# WARNING: As of cx_freeze there is a bug?
# when this is empty, its hooks will not kick in
# and won't clean platform irrelevant modules
# like dbm mentioned above.
bin_includes = [
"vendor"
]
include_files = [
"version.py",
"common",
"LICENSE",
"README.md"
]
icon_path = None
mac_icon_path = resources_dir / "AYON.icns"
if IS_WINDOWS:
icon_path = (resources_dir / "AYON.ico").as_posix()
install_requires.extend([
# `pywin32` packages
"win32ctypes",
"win32comext",
"pythoncom"
])
build_exe_options = dict(
build_exe="build/output",
packages=install_requires,
includes=includes,
excludes=excludes,
bin_includes=bin_includes,
include_files=include_files,
optimize=0,
replace_paths=[("*", "")],
)
bdist_mac_options = dict(
bundle_name=f"AYON {__version__}",
iconfile=mac_icon_path
)
executables = [
Executable(
"start.py",
base=base,
target_name="ayon",
icon=icon_path
),
]
if IS_WINDOWS:
executables.append(
Executable(
"start.py",
base=None,
target_name="ayon_console",
icon=icon_path
)
)
build_exe_options["include_msvcr"] = True
if IS_LINUX:
executables.append(
Executable(
"app_launcher.py",
base=None,
target_name="app_launcher",
)
)
setup(
name="AYON",
version=__version__,
description="AYON Desktop Client",
options={
"build_exe": build_exe_options,
"bdist_mac": bdist_mac_options,
},
executables=executables,
packages=[]
)