1
- import sys
1
+ import platform
2
2
from argparse import ArgumentParser
3
3
4
4
from PyInstaller .building .api import COLLECT , EXE , PYZ
5
5
from PyInstaller .building .build_main import Analysis
6
6
from PyInstaller .building .osx import BUNDLE
7
+ from PyInstaller .utils .hooks import collect_all
7
8
from tomllib import load
8
9
9
10
parser = ArgumentParser ()
@@ -13,20 +14,24 @@ options = parser.parse_args()
13
14
with open ("pyproject.toml" , "rb" ) as file :
14
15
pyproject = load (file )["project" ]
15
16
16
- name = pyproject ["name" ] if sys . platform == "win32 " else "tagstudio"
17
- icon = None
18
- if sys . platform == "win32 " :
17
+ name = pyproject ["name" ] if platform . system () == "Windows " else "tagstudio"
18
+
19
+ if platform . system () == "Windows " :
19
20
icon = "src/tagstudio/resources/icon.ico"
20
- elif sys . platform == "darwin " :
21
+ elif platform . system () == "Darwin " :
21
22
icon = "src/tagstudio/resources/icon.icns"
23
+ else :
24
+ icon = None
25
+
26
+ datas , binaries , hiddenimports = collect_all ("tagstudio" )
22
27
23
28
24
29
a = Analysis (
25
30
["src/tagstudio/main.py" ],
26
31
pathex = [],
27
- binaries = [] ,
28
- datas = [( "src/tagstudio" , "tagstudio" )] ,
29
- hiddenimports = [] ,
32
+ binaries = binaries ,
33
+ datas = datas ,
34
+ hiddenimports = hiddenimports ,
30
35
hookspath = [],
31
36
hooksconfig = {},
32
37
excludes = [],
@@ -76,16 +81,17 @@ coll = (
76
81
)
77
82
)
78
83
79
- app = BUNDLE (
80
- exe if coll is None else coll ,
81
- name = f"{ pyproject ['name' ]} .app" ,
82
- icon = icon ,
83
- bundle_identifier = "com.cyanvoxel.tagstudio" ,
84
- version = pyproject ["version" ],
85
- info_plist = {
86
- "NSAppleScriptEnabled" : False ,
87
- "NSPrincipalClass" : "NSApplication" ,
88
- },
89
- )
84
+ if platform .system () == "Darwin" :
85
+ app = BUNDLE (
86
+ exe if coll is None else coll ,
87
+ name = f"{ pyproject ['name' ]} .app" ,
88
+ icon = icon ,
89
+ bundle_identifier = "com.cyanvoxel.tagstudio" ,
90
+ version = pyproject ["version" ],
91
+ info_plist = {
92
+ "NSAppleScriptEnabled" : False ,
93
+ "NSPrincipalClass" : "NSApplication" ,
94
+ },
95
+ )
90
96
91
97
# vi: ft=python
0 commit comments