Skip to content

Commit 398cd4e

Browse files
committed
fix(pyinstaller): consume from pyproject
1 parent 94761b6 commit 398cd4e

File tree

1 file changed

+25
-19
lines changed

1 file changed

+25
-19
lines changed

tagstudio.spec

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
import sys
1+
import platform
22
from argparse import ArgumentParser
33

44
from PyInstaller.building.api import COLLECT, EXE, PYZ
55
from PyInstaller.building.build_main import Analysis
66
from PyInstaller.building.osx import BUNDLE
7+
from PyInstaller.utils.hooks import collect_all
78
from tomllib import load
89

910
parser = ArgumentParser()
@@ -13,20 +14,24 @@ options = parser.parse_args()
1314
with open("pyproject.toml", "rb") as file:
1415
pyproject = load(file)["project"]
1516

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":
1920
icon = "src/tagstudio/resources/icon.ico"
20-
elif sys.platform == "darwin":
21+
elif platform.system() == "Darwin":
2122
icon = "src/tagstudio/resources/icon.icns"
23+
else:
24+
icon = None
25+
26+
datas, binaries, hiddenimports = collect_all("tagstudio")
2227

2328

2429
a = Analysis(
2530
["src/tagstudio/main.py"],
2631
pathex=[],
27-
binaries=[],
28-
datas=[("src/tagstudio", "tagstudio")],
29-
hiddenimports=[],
32+
binaries=binaries,
33+
datas=datas,
34+
hiddenimports=hiddenimports,
3035
hookspath=[],
3136
hooksconfig={},
3237
excludes=[],
@@ -76,16 +81,17 @@ coll = (
7681
)
7782
)
7883

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+
)
9096

9197
# vi: ft=python

0 commit comments

Comments
 (0)