Repository navigation
Expand file tree
/
Copy pathsetup.py
More file actions
88 lines (75 loc) · 3.2 KB
/
Copy pathsetup.py
File metadata and controls
88 lines (75 loc) · 3.2 KB
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
"""
py2app build script for NSO GameCube Controller Bridge.
Usage:
make build # Build .app (version from git or VERSION=1.0.0)
make build VERSION=1.0.0 # Build with specific version (shows in About dialog)
python setup.py py2app -A # Alias mode (development, uses source in-place)
The plist (CFBundleVersion, NSHumanReadableCopyright) controls the About dialog.
Edit COPYRIGHT in this file to set the copyright string.
"""
import os
from setuptools import setup
# Version and copyright - set VERSION=1.0.0 when building: make build VERSION=1.0.0
VERSION = os.environ.get("VERSION", "1.0.0")
COPYRIGHT = "Copyright © 2026 Isaac Smith" # Shown in About dialog
APP = ["launcher.py"]
DATA_FILES = ["main.py", "dsu_server.py", "controller_storage.py", "version_check.py"]
def _find_tcl_tk_frameworks():
"""Find Tcl/Tk frameworks to bundle. Skip /System (SIP) - use /Library only."""
frameworks = []
for fw in ["Tcl.framework", "Tk.framework"]:
path = os.path.join("/Library/Frameworks", fw)
if os.path.exists(path):
frameworks.append(path)
return frameworks
def _find_tcl_tk_resources():
"""Find Tcl/Tk script directories and assets to bundle (for Homebrew Python etc)."""
base_dir = os.path.dirname(os.path.abspath(__file__))
assets_dir = os.path.join(base_dir, "assets")
try:
import tkinter as tk
tcl = tk.Tcl()
tcl_lib = tcl.eval("info library")
base = os.path.dirname(os.path.dirname(tcl_lib))
resources = list(DATA_FILES)
if os.path.isdir(assets_dir):
resources.append(assets_dir)
for sub in ["tcl9.0", "tcl8.6", "tk9.0", "tk8.6"]:
path = os.path.join(base, "lib", sub)
if os.path.isdir(path):
init = os.path.join(path, "init.tcl") if "tcl" in sub else os.path.join(path, "tk.tcl")
if os.path.exists(init):
resources.append(path)
return resources
except Exception:
resources = list(DATA_FILES)
if os.path.isdir(assets_dir):
resources.append(assets_dir)
return resources
OPTIONS = {
"py2app": {
"argv_emulation": False, # Don't use with GUI toolkits
"iconfile": os.path.join(os.path.dirname(__file__), "assets", "NSO_GC_BRIDGE.icns"),
"resources": _find_tcl_tk_resources(),
"packages": ["usb", "bleak", "tkinter"], # Python packages
"includes": ["tkinter", "hid"], # hid is C extension (.so); include so it goes to lib-dynload
"excludes": ["test", "unittest"], # Exclude stdlib test suite (reduces size, avoids copy issues)
"frameworks": _find_tcl_tk_frameworks(), # Bundle Tcl/Tk frameworks
"plist": {
"CFBundleName": "NSO GC Bridge",
"CFBundleDisplayName": "NSO GameCube Controller Bridge",
"CFBundleIdentifier": "com.nso-gc-bridge.launcher",
"CFBundleVersion": VERSION,
"CFBundleShortVersionString": VERSION,
"NSHumanReadableCopyright": COPYRIGHT,
"NSHighResolutionCapable": True,
},
}
}
setup(
name="NSO-GC-Bridge",
app=APP,
data_files=[],
options=OPTIONS,
setup_requires=["py2app"],
)