forked from aqua5230/usage
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup_app.py
More file actions
114 lines (99 loc) · 3.17 KB
/
setup_app.py
File metadata and controls
114 lines (99 loc) · 3.17 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
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
from __future__ import annotations
import importlib
import tomllib
from pathlib import Path
from typing import Any
from setuptools import setup # type: ignore[import-untyped]
from setuptools.dist import Distribution # type: ignore[import-untyped]
APP = ["main.py"]
def _version() -> str:
pyproject = Path(__file__).with_name("pyproject.toml")
with pyproject.open("rb") as file:
data = tomllib.load(file)
return str(data["project"]["version"])
class Py2AppDistribution(Distribution): # type: ignore[misc]
def __init__(self, attrs: dict[str, object] | None = None) -> None:
super().__init__(attrs)
self.install_requires: list[str] = []
def finalize_options(self) -> None:
super().finalize_options()
self.install_requires = []
def _py2app_command() -> type[Any]:
py2app_module: Any = importlib.import_module("py2app.build_app")
py2app_base = py2app_module.py2app
class Py2AppCommand(py2app_base): # type: ignore[misc, valid-type]
def finalize_options(self) -> None:
self.distribution.install_requires = []
super().finalize_options()
return Py2AppCommand
if __name__ == "__main__":
version = _version()
OPTIONS = {
"argv_emulation": False,
"iconfile": "assets/usage.icns",
"resources": [
"assets/claude.webp",
"assets/claude_color_menubar.png",
"assets/codex.webp",
"assets/codex_color_menubar.png",
"assets/panels",
"i18n.json",
"pyproject.toml",
"tips/commands.json",
"usage_statusline.py",
"usage_statusline_forwarder.py",
"usage_session_resume.py",
],
"includes": [
"AppKit",
"Foundation",
"Quartz",
"WebKit",
"UserNotifications",
"objc",
"menubar",
"usage_notifications",
"tui",
"tui_sprite",
"usage_client",
"usage_rate",
"codex_loader",
"history_loader",
"pricing",
"setup_hook",
"update_checker",
"i18n",
"usage_cli",
"adapters",
"analyzer",
"ui",
"rich",
"rich.align",
"rich.console",
"rich.live",
"rich.panel",
"rich.style",
"rich.table",
"rich.text",
],
"plist": {
"CFBundleIdentifier": "com.lollapalooza.usage",
"CFBundleName": "usage",
"CFBundleDisplayName": "usage",
"CFBundleShortVersionString": version,
"CFBundleVersion": version,
"LSUIElement": True,
"LSMinimumSystemVersion": "12.0",
"NSHumanReadableCopyright": (
"Copyright © 2025-2026 lollapalooza. Licensed under AGPL-3.0-only."
),
},
}
setup(
app=APP,
cmdclass={"py2app": _py2app_command()},
distclass=Py2AppDistribution,
options={"py2app": OPTIONS},
setup_requires=["py2app"],
install_requires=[],
)