-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsetup.py
119 lines (106 loc) · 4.32 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
import sys
from cx_Freeze import setup, Executable
from pathlib import Path
"""NOTE
In order to build a SpectraChroma executable you need to have installed Python 3,
and the following Python modules (and their dependencies):
colour-science
matplotlib
XlsxWriter
cx_freeze
If you are on Ubuntu (Linux), you also need to install these Linux packages:
python3-tk
patchelf
Once those requirements are installed, open a shell (command prompt) on the
directory where is SpectraChroma's source and run the one of following commands:
python setup.py build
python setup.py bdist_msi
If you are on Linux, you might need to use the command "python3" instead of "python".
The argument "build" only creates a standalone program for Windows or Linux (depending
on which Operating System you are using). The argument "bdist_msi" creates both a
standalone program and a Windows installer (needless to say, this only works on Windows).
After the script finishes running, the standalone program is placed on the "build"
subdirectory, while the installer goes to the "dist" subdirectory.
"""
base = None
if sys.platform == "win32":
base = "Win32GUI"
executables = [
Executable(
"spec2cie_ui.py",
base=base,
icon=str(Path("lib", "icon.ico")),
copyright="(c) Tiago Becerra Paolini",
target_name="SpectraChroma",
# shortcut_name = "SpectraChroma",
# shortcut_dir = "DesktopFolder",
)
]
build_exe_options = {
"packages": ["spec2cie", "colour", "matplotlib", "scipy.spatial.transform._rotation_groups"],
"include_files": [
(str(Path("lib", "icon.png")), str(Path("lib", "icon.png"))),
(str(Path("lib", "Help.txt")), str(Path("lib", "Help.txt"))),
(str(Path("lib", "About.txt")), str(Path("lib", "About.txt"))),
(str(Path("lib", "License.txt")), "License.txt"),
(str(Path("lib", "License.txt")), str(Path("lib", "License.txt"))),
(str(Path("lib", "Citation.txt")), "Citation.txt"),
(str(Path("lib", "Citation.txt")), str(Path("lib", "Citation.txt"))),
],
"optimize": 1,
"include_msvcr": True,
"zip_include_packages": "*",
"zip_exclude_packages": ["scipy"],
}
# https://docs.microsoft.com/en-us/windows/win32/msi/shortcut-table
shortcut_table = [
("DesktopShortcut", # Shortcut
"DesktopFolder", # Directory_
"SpectraChroma", # Name
"TARGETDIR", # Component_
"[TARGETDIR]SpectraChroma.exe", # Target
None, # Arguments
None, # Description
None, # Hotkey
None, # Icon
None, # IconIndex
None, # ShowCmd
'TARGETDIR' # WkDir
),
("ProgramMenuShortcut", # Shortcut
"ProgramMenuFolder", # Directory_
"SpectraChroma", # Name
"TARGETDIR", # Component_
"[TARGETDIR]SpectraChroma.exe", # Target
None, # Arguments
None, # Description
None, # Hotkey
None, # Icon
None, # IconIndex
None, # ShowCmd
'TARGETDIR' # WkDir
)
]
msi_data = {"Shortcut": shortcut_table}
bdist_msi_options = {
"product_code": "{A2536964-4A51-43F1-AC11-7E0D64296FC1}",
"upgrade_code": "{239D6203-0061-4630-B97A-42E33E37C078}",
"target_name": "SpectraChroma-1.0.1-Windows-Installer",
"add_to_path": False,
"install_icon": str(Path("lib", "icon.ico")),
# "initial_target_dir": "ProgramFiles64Folder",
"all_users": True,
"summary_data": {
"author": "Tiago Becerra Paolini",
"comments": "Spectrum to CIE 1931 Chromaticity Diagram",
"keywords": "chromaticity; diagram; CIE; spectrum; color; colorimetry; spectroscopy",
},
'data': msi_data,
}
setup(
name="SpectraChroma",
version="1.0.1",
description="Spectrum to CIE 1931 Chromaticity Diagram",
options = {"build_exe": build_exe_options, "bdist_msi": bdist_msi_options},
executables=executables,
)