-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
82 lines (68 loc) · 1.94 KB
/
setup.py
File metadata and controls
82 lines (68 loc) · 1.94 KB
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
import sys
import sysconfig
from cx_Freeze import Executable, setup
from app import APP_AUTHOR, APP_DESCRIPTION, APP_NAME
app_name = APP_NAME
description = APP_DESCRIPTION
author = APP_AUTHOR
icon = "./icons/icon.ico"
# TODO: Generate a unique upgrade code by running the below command.
# python -c "import uuid; print(str(uuid.uuid3(uuid.NAMESPACE_DNS, 'myapp.example.com')).upper());"
# https://learn.microsoft.com/en-us/windows/win32/msi/using-an-upgradecode
upgrade_code = ""
# Start Menu Folder
start_folder = ""
base = "Win32GUI" if sys.platform == "win32" else None
install_dir = (
"ProgramFiles64Folder"
if sysconfig.get_platform() == "win-amd64"
else "ProgramFilesFolder"
)
build_exe_options = {
"zip_include_packages": ["encoder", "PySide6"],
"include_msvcr": True,
"excludes": [
"tkinter",
"wheel",
"setuptools",
"setuptools_scm",
"email",
"unittest",
"html",
"http",
"xml",
],
}
# Used to create the start menu folder
# https://learn.microsoft.com/en-us/windows/win32/msi/directory-table
directory_table = [
("ProgramMenuFolder", "TARGETDIR", "."),
("ProgramMenuSubFolder", "ProgramMenuFolder", start_folder or "."),
]
msi_data = {"Directory": directory_table}
bdist_msi_options = {
"data": msi_data,
"upgrade_code": f"{{{upgrade_code}}}" if upgrade_code else None,
"summary_data": {"author": author},
"initial_target_dir": f"[{install_dir}]{app_name}",
"install_icon": icon,
}
executable = Executable(
script="main.py",
base=base,
target_name=app_name,
icon=icon,
shortcut_name=app_name,
shortcut_dir="ProgramMenuSubFolder",
)
setup(
name=app_name,
description=description,
options={
"build_exe": build_exe_options,
"bdist_msi": bdist_msi_options,
},
executables=[executable],
use_scm_version={"write_to": "app/_version.py"},
setup_requires=["setuptools_scm"],
)