forked from JYU-IBA/potku
-
Notifications
You must be signed in to change notification settings - Fork 0
/
potku.spec
114 lines (101 loc) · 2.7 KB
/
potku.spec
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
# -*- mode: python -*-
import platform
system = platform.system()
if system == "Darwin":
ADD_TK_AND_TCL = False
extras = [("external/lib/*.dylib", ".")]
icon = "ui_icons/potku/potku_logo_icons/potku_logo_icon.icns"
console = False
if ADD_TK_AND_TCL:
# PyInstaller has issues with building Mac apps. By default it does not
# bundle tk and tcl with the app even though those are required.
# There are two workarounds:
# 1. it should be enough to just add empty 'tk' and 'tcl' folders
# to the bundle. Just set ADD_TK_AND_TCL to true to achieve this.
# 2. edit the hook-_tkinter.py module of the PyInstaller
# installation that is used for bundling. For more info, see
# https://github.com/pyinstaller/pyinstaller/issues/3753
import os
extras2 = [
("tcl", "tcl"),
("tk", "tk")
]
for folder, _ in extras2:
os.makedirs(folder, exist_ok=True)
open(os.path.join(folder, ".ignore"), "w").close()
extras += extras2
elif system == "Windows":
extras = [("external/bin/*.dll", "external/bin/")]
icon = "ui_icons/potku/potku_logo_icons/potku_icon.ico"
console = True
else:
extras = [("external/lib/*.so*", ".")]
icon = "ui_icons/potku/potku_logo_icons/potku_icon.ico"
console = True
block_cipher = None
bins = [
(f"external/bin/{file.name}", "external/bin/")
for file in os.scandir("external/bin")
if file.name != "jibal.conf"
]
a = Analysis(
["potku.py"],
pathex=[],
binaries=bins,
datas=[
("external/bin/jibal.conf", "external/bin/"),
("external/share", "external/share"),
("ui_files", "ui_files"),
("ui_icons", "ui_icons"),
("images", "images"),
*extras
],
hiddenimports=[
"scipy._lib.messagestream",
"pkg_resources.py2_warn"
],
hookspath=[],
runtime_hooks=[],
excludes=[
"tkagg"
],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher
)
pyz = PYZ(
a.pure,
a.zipped_data,
cipher=block_cipher
)
exe = EXE(
pyz,
a.scripts,
exclude_binaries=True,
name="potku",
debug=False,
strip=False,
upx=True,
console=console,
icon=icon
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name="potku"
)
if system == "Darwin":
app = BUNDLE(
coll,
name="potku.app",
icon=icon,
bundle_identifier=None,
info_plist={
'NSPrincipalClass': 'NSApplication',
'NSAppleScriptEnabled': False
},
)