Skip to content

Commit 08d945b

Browse files
committed
Add desktop and start menu shortcuts for Windows installer
1 parent 7ba533c commit 08d945b

File tree

3 files changed

+53
-12
lines changed

3 files changed

+53
-12
lines changed

.github/workflows/package.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ jobs:
3737
run: echo ${GITHUB_REF/refs\/tags\/v/} > version.txt
3838
shell: bash
3939
- name: Build package
40+
run: python packager-setup.py bdist
41+
- name: Build installer
4042
run: python packager-setup.py bdist_${{ matrix.platform.bdist-target }}
4143
- name: Release
4244
uses: softprops/action-gh-release@v1

packager-setup.py

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,47 @@
11
import sys
22
from cx_Freeze import setup, Executable
33

4+
# base="Win32GUI" should be used only for Windows GUI app
5+
base = None
6+
if sys.platform == "win32":
7+
base = "Win32GUI"
8+
9+
version = ""
10+
with open("version.txt") as f:
11+
version = f.read().rstrip("\n")
12+
413
sys.path.insert(0, "src")
514

15+
shortcut_table = [
16+
("DesktopShortcut", # Shortcut
17+
"DesktopFolder", # Directory_
18+
"Tomography Analysis Tool", # Name
19+
"TARGETDIR", # Component_
20+
"[TARGETDIR]tat.exe", # Target
21+
None, # Arguments
22+
None, # Description
23+
None, # Hotkey
24+
None, # Icon
25+
None, # IconIndex
26+
None, # ShowCmd
27+
'TARGETDIR' # WkDir
28+
)
29+
]
30+
31+
msi_data = {
32+
"Shortcut": shortcut_table
33+
}
34+
35+
bdist_msi_options = {
36+
"summary_data": {
37+
"author": "Hugo Haldi",
38+
"comments": "Tomography Analysis Tool",
39+
"keywords": "TAT Tomography Analysis Tool"
40+
},
41+
"data": msi_data,
42+
"upgrade_code": "{22872b66-f52b-40fd-b973-951a9cac3620}"
43+
}
44+
645
build_exe_options = {
746
"packages": [
847
"PySide6",
@@ -16,20 +55,21 @@
1655
"path": sys.path
1756
}
1857

19-
# base="Win32GUI" should be used only for Windows GUI app
20-
base = None
21-
if sys.platform == "win32":
22-
base = "Win32GUI"
23-
24-
version = ""
25-
with open("version.txt") as f:
26-
version = f.read().rstrip("\n")
58+
executables = [
59+
Executable("src/tat/__main__.py",
60+
copyright="Copyright (C) 2022 TAT",
61+
base=base,
62+
target_name="tat",
63+
shortcut_name="Tomography Analysis Tool")
64+
]
2765

2866
setup(
2967
name="tat",
3068
version=version,
3169
description="Tomography Analysis Tool",
32-
options={"build_exe": build_exe_options},
33-
executables=[Executable("src/tat/__main__.py",
34-
base=base, target_name="tat")]
70+
options={
71+
"build_exe": build_exe_options,
72+
"bdist_msi": bdist_msi_options
73+
},
74+
executables=executables
3575
)

version.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)