-
Notifications
You must be signed in to change notification settings - Fork 88
/
setup.py
113 lines (95 loc) · 3.13 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
import os
import sys
from cx_Freeze import Executable
from cx_Freeze import setup
from src.config import version
company_name = "FAF Community"
product_name = "Forged Alliance Forever"
root_dir = os.path.dirname(os.path.abspath(__file__))
res_dir = os.path.join(root_dir, "res")
build_version = os.getenv("BUILD_VERSION").replace(" ", "")
version.write_version_file(build_version, res_dir)
msi_version = version.msi_version(build_version)
shortcut_table = [
(
"DesktopShortcut", # Shortcut
"DesktopFolder", # Directory_
"FA Forever", # Name
"TARGETDIR", # Component_
"[TARGETDIR]FAForever.exe", # Target
None, # Arguments
None, # Description
None, # Hotkey
None, # Icon
None, # IconIndex
None, # ShowCmd
"TARGETDIR", # WkDir
),
]
target_dir = "[ProgramFilesFolder][ProductName]"
upgrade_code = "{ADE2A55B-834C-4D8D-A071-7A91A3A266B7}"
if os.getenv("BETA"): # Beta build
product_name += " Beta"
upgrade_code = "{2A336240-1D51-4726-B36f-78B998DD3740}"
bdist_msi_options = {
"upgrade_code": upgrade_code,
"initial_target_dir": target_dir,
"add_to_path": False,
"data": {"Shortcut": shortcut_table},
"all_users": True,
}
if sys.platform == "win32":
include_mvcr = True
exe_base = "Win32Gui"
exe_name = "FAForever.exe"
else:
include_mvcr = False
exe_base = None
exe_name = "FAForever"
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {
"include_files": [
"res",
("build_setup", "natives"),
],
"include_msvcr": include_mvcr,
"optimize": 2,
"silent": True,
# copied from https://github.com/marcelotduarte/cx_Freeze/blob/5e42a97d2da321eae270cdcc65cdc777eb8e8fc4/samples/pyqt6-simplebrowser/setup.py # noqa: E501
# and unexcluded overexcluded
"excludes": ["tkinter", "unittest", "tcl"],
"zip_include_packages": ["*"],
"zip_exclude_packages": [],
"build_exe": "build/faf_python_client",
}
platform_options = {
"executables": [
Executable(
"src/__main__.py",
base=exe_base,
target_name=exe_name,
icon="res/faf.ico",
),
],
"options": {
"build_exe": build_exe_options,
"bdist_msi": bdist_msi_options,
},
"version": msi_version,
}
setup(
name=product_name,
description="Forged Alliance Forever - Lobby Client",
long_description=(
"FA Forever is a community project that allows you to "
"play Supreme Commander and Supreme Commander: Forged "
"Alliance online with people across the globe. "
"Provides new game play modes, including cooperative "
"play, ranked ladder play, and featured mods."
),
author="FA Forever Community",
maintainer="Sheeo",
url="http://www.faforever.com",
license="GNU General Public License, Version 3",
**platform_options,
)