pendify 0.1.12__tar.gz → 0.1.14__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pendify-0.1.12/src/pendify.egg-info → pendify-0.1.14}/PKG-INFO +69 -4
- {pendify-0.1.12 → pendify-0.1.14}/README.md +66 -2
- {pendify-0.1.12 → pendify-0.1.14}/pyproject.toml +4 -3
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify/__main__.py +77 -23
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify/alert.py +25 -1
- pendify-0.1.14/src/pendify/autoclick.py +255 -0
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify/autostart.py +53 -4
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify/client.py +42 -9
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify/config.py +28 -3
- pendify-0.1.14/src/pendify/macos/PendiFy +0 -0
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify/page.py +122 -6
- pendify-0.1.14/src/pendify/permission.py +107 -0
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify/runfile.py +2 -1
- pendify-0.1.14/src/pendify/tft_app.py +297 -0
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify/tray.py +6 -1
- pendify-0.1.14/src/pendify/tray_macos.py +275 -0
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify/update.py +20 -4
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify/watcher.py +30 -5
- {pendify-0.1.12 → pendify-0.1.14/src/pendify.egg-info}/PKG-INFO +69 -4
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify.egg-info/SOURCES.txt +6 -1
- {pendify-0.1.12 → pendify-0.1.14}/LICENSE +0 -0
- {pendify-0.1.12 → pendify-0.1.14}/MANIFEST.in +0 -0
- {pendify-0.1.12 → pendify-0.1.14}/setup.cfg +0 -0
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify/__init__.py +0 -0
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify/codes.py +0 -0
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify/icon.py +0 -0
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify/pairing.py +0 -0
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify/pendify.ico +0 -0
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify/plate_almena.py +0 -0
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify/qr.py +0 -0
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify/sponsor_art.py +0 -0
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify/worker.py +0 -0
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify.egg-info/dependency_links.txt +0 -0
- {pendify-0.1.12 → pendify-0.1.14}/src/pendify.egg-info/top_level.txt +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pendify
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.14
|
|
4
4
|
Summary: Pairs this PC with a phone account by a QR on a loopback page and sends it two kinds of alerts.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Homepage, https://github.com/ElkinDev/PendiFy
|
|
7
7
|
Project-URL: Source, https://github.com/ElkinDev/PendiFy
|
|
8
|
-
Keywords: notifications,alerts,phone,qr,pairing,windows
|
|
8
|
+
Keywords: notifications,alerts,phone,qr,pairing,windows,macos
|
|
9
9
|
Classifier: Operating System :: Microsoft :: Windows
|
|
10
|
+
Classifier: Operating System :: MacOS
|
|
10
11
|
Classifier: Programming Language :: Python :: 3
|
|
11
12
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
12
13
|
Requires-Python: >=3.10
|
|
@@ -18,10 +19,18 @@ Dynamic: license-file
|
|
|
18
19
|
|
|
19
20
|
## Español
|
|
20
21
|
|
|
21
|
-
Un programa pequeño para Windows que avisa en tu teléfono cuando se encuentra tu partida y cuando empieza.
|
|
22
|
+
Un programa pequeño para **Windows y Mac** que avisa en tu teléfono cuando se encuentra tu partida y cuando empieza.
|
|
22
23
|
Se enlaza una sola vez con tu cuenta de Pendi leyendo un código QR, sin crear ninguna cuenta nueva.
|
|
23
24
|
Es gratis, no pide permisos de administrador y solo usa Python.
|
|
24
25
|
|
|
26
|
+
**Nuevo: soporte para Mac.** Funciona con el cliente de League of Legends y con la app de **Teamfight Tactics** para Mac, y en esa app acepta la partida por ti con un clic automático. Se instala con una línea en la Terminal: mira [macOS](#macos).
|
|
27
|
+
|
|
28
|
+

|
|
29
|
+
|
|
30
|
+
Así llega un aviso: el programa espera al cliente del juego, detecta la partida y envía el aviso a tu cuenta.
|
|
31
|
+
|
|
32
|
+

|
|
33
|
+
|
|
25
34
|
### Instalar
|
|
26
35
|
|
|
27
36
|
Pulsa Windows + R, pega esta línea completa y pulsa Enter. También sirve en PowerShell o en el Símbolo del sistema.
|
|
@@ -51,6 +60,23 @@ Así no se crean los accesos directos en el Escritorio ni en el menú Inicio, y
|
|
|
51
60
|
|
|
52
61
|
El programa revisa PyPI cada seis horas y, cuando hay una versión más nueva, la instala en segundo plano. La página ofrece entonces «Reiniciar ahora» para empezar a usarla. Si la instalación falla, la página ofrece «Reintentar» en cualquier modo y, la primera vez que falla una versión, la siguiente revisión llega a los diez minutos. Para apagarlo, inícialo con `--no-update` o escribe `"update": "off"` en `%APPDATA%\pendify\config.json`. Las actualizaciones automáticas se instalan para tu usuario (--user).
|
|
53
62
|
|
|
63
|
+
### macOS
|
|
64
|
+
|
|
65
|
+
PendiFy también funciona en Mac (Apple Silicon o Intel) con League of Legends / TFT instalado. Abre la app Terminal, pega esta línea y pulsa Enter:
|
|
66
|
+
|
|
67
|
+
curl -fsSL https://raw.githubusercontent.com/ElkinDev/PendiFy/main/install.sh | bash
|
|
68
|
+
|
|
69
|
+
El instalador busca Python 3.10 o más nuevo (si no lo hay y tienes Homebrew, instala `python@3.12`), instala PendiFy en su propio entorno en `~/Library/Application Support/pendify/venv`, crea la app `PendiFy` en `~/Applications` (la encuentras con Spotlight o en Launchpad) y la inicia. Para actualizar, vuelve a pegar la misma línea.
|
|
70
|
+
|
|
71
|
+
- Iniciar: abre `PendiFy` desde Spotlight o Launchpad; si ya está abierto, abre su página.
|
|
72
|
+
- Detener: pulsa «Salir» en la página, o en el menú del icono de PendiFy en la barra de menús, arriba a la derecha.
|
|
73
|
+
- Icono en la barra de menús: un clic en el icono de PendiFy, arriba a la derecha, abre un menú para abrir la página, pausar o reanudar los avisos y salir del programa, también con la página y el navegador cerrados. No hay icono en el Dock.
|
|
74
|
+
- Iniciar con macOS: el interruptor «Iniciar con macOS» de la página crea un LaunchAgent solo para tu usuario, sin permisos de administrador.
|
|
75
|
+
- Configuración: `~/Library/Application Support/pendify/config.json`; el registro del programa queda en `pendify.log` en esa misma carpeta.
|
|
76
|
+
- Sonido: el aviso suena con los sonidos del sistema.
|
|
77
|
+
- App de Teamfight Tactics: si juegas TFT con su app propia (sin el cliente de League), PendiFy lee el registro del juego y avisa a tu teléfono cuando aparece la partida y cuando empieza. Esa app no ofrece una forma de aceptar desde fuera; con el interruptor «Aceptar partida automáticamente» de la página, encendido por defecto, PendiFy pone TFT al frente y hace clic en Aceptar por ti (macOS pide una vez el permiso de Accesibilidad en Ajustes del Sistema > Privacidad y seguridad > Accesibilidad). Con el cliente de League se acepta solo como en Windows.
|
|
78
|
+
- Desinstalar: `curl -fsSL https://raw.githubusercontent.com/ElkinDev/PendiFy/main/uninstall.sh | bash`. Quita la app, el inicio con macOS y el entorno; la configuración se queda.
|
|
79
|
+
|
|
54
80
|
### Enlazar
|
|
55
81
|
|
|
56
82
|
Al iniciarse, el navegador abre una página local con un código QR. Escanéalo con la cámara del teléfono: se abre la app Pendi y te pide confirmar el enlace. La página muestra cuando el enlace quedó hecho.
|
|
@@ -83,10 +109,18 @@ Licencia: MIT
|
|
|
83
109
|
|
|
84
110
|
## English
|
|
85
111
|
|
|
86
|
-
A small Windows
|
|
112
|
+
A small program for **Windows and Mac** that alerts your phone when your match is found and when it starts.
|
|
87
113
|
It links once to your Pendi account by scanning a QR code, with no new account of any kind.
|
|
88
114
|
It is free, needs no administrator rights and only uses Python.
|
|
89
115
|
|
|
116
|
+
**New: Mac support.** It works with the League of Legends client and with the **Teamfight Tactics** app for Mac, and in that app it accepts the match for you with an automatic click. It installs with one line in the Terminal: see [macOS](#macos-1).
|
|
117
|
+
|
|
118
|
+

|
|
119
|
+
|
|
120
|
+
How an alert arrives: the program waits for the game client, detects the match and sends the alert to your account.
|
|
121
|
+
|
|
122
|
+

|
|
123
|
+
|
|
90
124
|
### Install
|
|
91
125
|
|
|
92
126
|
Press Windows + R, paste this whole line and press Enter. It also works in PowerShell or the Command Prompt.
|
|
@@ -116,6 +150,23 @@ This way leaves no shortcut on the Desktop or in the Start menu, and the start w
|
|
|
116
150
|
|
|
117
151
|
The program checks PyPI every six hours and, when a newer version exists, installs it in the background. The page then offers «Restart now» to start using it. If the install fails, the page offers «Try again» in either mode and, the first time a version fails, the next check comes ten minutes later. To turn this off, start it with `--no-update` or write `"update": "off"` in `%APPDATA%\pendify\config.json`. Automatic updates install for your user (--user).
|
|
118
152
|
|
|
153
|
+
### macOS
|
|
154
|
+
|
|
155
|
+
PendiFy also runs on a Mac (Apple Silicon or Intel) with League of Legends / TFT installed. Open the Terminal app, paste this line and press Enter:
|
|
156
|
+
|
|
157
|
+
curl -fsSL https://raw.githubusercontent.com/ElkinDev/PendiFy/main/install.sh | bash
|
|
158
|
+
|
|
159
|
+
The installer looks for Python 3.10 or newer (with none and Homebrew present, it installs `python@3.12`), installs PendiFy in its own environment in `~/Library/Application Support/pendify/venv`, makes the `PendiFy` app in `~/Applications` (find it with Spotlight or in Launchpad) and starts it. To update, paste the same line again.
|
|
160
|
+
|
|
161
|
+
- Start: open `PendiFy` from Spotlight or Launchpad; if it already runs, its page opens.
|
|
162
|
+
- Stop: press "Quit" on the page, or in the menu of the PendiFy icon in the menu bar, at the top right.
|
|
163
|
+
- Menu bar icon: a click on the PendiFy icon at the top right of the screen opens a menu that opens the page, pauses or resumes the alerts and quits the program, also with the page and the browser closed. There is no Dock icon.
|
|
164
|
+
- Start with macOS: the page's "Start with macOS" switch makes a LaunchAgent for your user only, with no administrator rights.
|
|
165
|
+
- Config: `~/Library/Application Support/pendify/config.json`; the program's log is `pendify.log` in that same folder.
|
|
166
|
+
- Sound: the alert plays the system's sounds.
|
|
167
|
+
- Teamfight Tactics app: if you play TFT with its own app (no League client), PendiFy reads the game's log and alerts your phone when the match is found and when it starts. That app offers no way to accept from outside; with the page's "Accept the match automatically" switch, on by default, PendiFy brings TFT to the front and clicks Accept for you (macOS asks once for the Accessibility permission in System Settings > Privacy & Security > Accessibility). With the League client it is accepted for you, as on Windows.
|
|
168
|
+
- Uninstall: `curl -fsSL https://raw.githubusercontent.com/ElkinDev/PendiFy/main/uninstall.sh | bash`. It removes the app, the start with macOS and the environment; the config is kept.
|
|
169
|
+
|
|
119
170
|
### Link
|
|
120
171
|
|
|
121
172
|
When it starts, the browser opens a local page with a QR code. Scan it with the phone's camera: the Pendi app opens and asks you to confirm the link. The page shows when the link is done.
|
|
@@ -159,3 +210,17 @@ The second sends one alert with the stored pair and prints one line with the ans
|
|
|
159
210
|
Both commands take `--data-dir <dir>`, used instead of `%APPDATA%` (the config file lives in a folder under it), and `--worker <address>`, used instead of the pairing service's address and accepted only as `http://127.0.0.1:<port>` or `http://localhost:<port>`, so a test run never reaches the real service. `--client-lockfile <file>` replaces the game client's lockfile, with no read of the running processes, and the client it names is reached over plain http on 127.0.0.1, so a test run never reaches a real client.
|
|
160
211
|
|
|
161
212
|
python -m unittest discover -s tests -v
|
|
213
|
+
|
|
214
|
+
### Releasing the macOS app
|
|
215
|
+
|
|
216
|
+
`install.sh` downloads `PendiFy.app` prebuilt, signed with the Developer ID of team BL4KZH338B and notarized by Apple, so that on any Mac the Login Items list and the permission prompts name the developer. It builds the app on the Mac instead while no release is published, when a check of the download (its sha256, its signature, its team) fails, or with `PENDIFY_BUILD_APP=1`. A release is made on the maintainer's Mac, whose login keychain holds the Developer ID Application identity of that team.
|
|
217
|
+
|
|
218
|
+
Once, store the notary credentials in the keychain under the profile `PendiFy`; the command asks for an app-specific password made for it in the Apple Account settings:
|
|
219
|
+
|
|
220
|
+
xcrun notarytool store-credentials PendiFy --apple-id <apple id> --team-id BL4KZH338B
|
|
221
|
+
|
|
222
|
+
Then, for each release, from a commit that is pushed, with no other change in the tree and `gh` signed in:
|
|
223
|
+
|
|
224
|
+
tools/release-macos-app.sh
|
|
225
|
+
|
|
226
|
+
It builds the app as `install.sh` builds it, signs it with the hardened runtime and a secure timestamp, has Apple notarize it, staples the ticket, publishes the zip as the GitHub release `macos-app-<version>` (the version in `pyproject.toml`, one release per version) and writes the zip's URL and sha256 into `install.sh`. Commit and push `install.sh` after the release: installs download the new app only once that `install.sh` is on `main`. `NOTARY_PROFILE` names another profile, and `tools/release-macos-app.sh --no-publish` only builds and signs the app into `build/macos-app`, with no notarization, no release and no change to `install.sh`.
|
|
@@ -2,10 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
## Español
|
|
4
4
|
|
|
5
|
-
Un programa pequeño para Windows que avisa en tu teléfono cuando se encuentra tu partida y cuando empieza.
|
|
5
|
+
Un programa pequeño para **Windows y Mac** que avisa en tu teléfono cuando se encuentra tu partida y cuando empieza.
|
|
6
6
|
Se enlaza una sola vez con tu cuenta de Pendi leyendo un código QR, sin crear ninguna cuenta nueva.
|
|
7
7
|
Es gratis, no pide permisos de administrador y solo usa Python.
|
|
8
8
|
|
|
9
|
+
**Nuevo: soporte para Mac.** Funciona con el cliente de League of Legends y con la app de **Teamfight Tactics** para Mac, y en esa app acepta la partida por ti con un clic automático. Se instala con una línea en la Terminal: mira [macOS](#macos).
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
Así llega un aviso: el programa espera al cliente del juego, detecta la partida y envía el aviso a tu cuenta.
|
|
14
|
+
|
|
15
|
+

|
|
16
|
+
|
|
9
17
|
### Instalar
|
|
10
18
|
|
|
11
19
|
Pulsa Windows + R, pega esta línea completa y pulsa Enter. También sirve en PowerShell o en el Símbolo del sistema.
|
|
@@ -35,6 +43,23 @@ Así no se crean los accesos directos en el Escritorio ni en el menú Inicio, y
|
|
|
35
43
|
|
|
36
44
|
El programa revisa PyPI cada seis horas y, cuando hay una versión más nueva, la instala en segundo plano. La página ofrece entonces «Reiniciar ahora» para empezar a usarla. Si la instalación falla, la página ofrece «Reintentar» en cualquier modo y, la primera vez que falla una versión, la siguiente revisión llega a los diez minutos. Para apagarlo, inícialo con `--no-update` o escribe `"update": "off"` en `%APPDATA%\pendify\config.json`. Las actualizaciones automáticas se instalan para tu usuario (--user).
|
|
37
45
|
|
|
46
|
+
### macOS
|
|
47
|
+
|
|
48
|
+
PendiFy también funciona en Mac (Apple Silicon o Intel) con League of Legends / TFT instalado. Abre la app Terminal, pega esta línea y pulsa Enter:
|
|
49
|
+
|
|
50
|
+
curl -fsSL https://raw.githubusercontent.com/ElkinDev/PendiFy/main/install.sh | bash
|
|
51
|
+
|
|
52
|
+
El instalador busca Python 3.10 o más nuevo (si no lo hay y tienes Homebrew, instala `python@3.12`), instala PendiFy en su propio entorno en `~/Library/Application Support/pendify/venv`, crea la app `PendiFy` en `~/Applications` (la encuentras con Spotlight o en Launchpad) y la inicia. Para actualizar, vuelve a pegar la misma línea.
|
|
53
|
+
|
|
54
|
+
- Iniciar: abre `PendiFy` desde Spotlight o Launchpad; si ya está abierto, abre su página.
|
|
55
|
+
- Detener: pulsa «Salir» en la página, o en el menú del icono de PendiFy en la barra de menús, arriba a la derecha.
|
|
56
|
+
- Icono en la barra de menús: un clic en el icono de PendiFy, arriba a la derecha, abre un menú para abrir la página, pausar o reanudar los avisos y salir del programa, también con la página y el navegador cerrados. No hay icono en el Dock.
|
|
57
|
+
- Iniciar con macOS: el interruptor «Iniciar con macOS» de la página crea un LaunchAgent solo para tu usuario, sin permisos de administrador.
|
|
58
|
+
- Configuración: `~/Library/Application Support/pendify/config.json`; el registro del programa queda en `pendify.log` en esa misma carpeta.
|
|
59
|
+
- Sonido: el aviso suena con los sonidos del sistema.
|
|
60
|
+
- App de Teamfight Tactics: si juegas TFT con su app propia (sin el cliente de League), PendiFy lee el registro del juego y avisa a tu teléfono cuando aparece la partida y cuando empieza. Esa app no ofrece una forma de aceptar desde fuera; con el interruptor «Aceptar partida automáticamente» de la página, encendido por defecto, PendiFy pone TFT al frente y hace clic en Aceptar por ti (macOS pide una vez el permiso de Accesibilidad en Ajustes del Sistema > Privacidad y seguridad > Accesibilidad). Con el cliente de League se acepta solo como en Windows.
|
|
61
|
+
- Desinstalar: `curl -fsSL https://raw.githubusercontent.com/ElkinDev/PendiFy/main/uninstall.sh | bash`. Quita la app, el inicio con macOS y el entorno; la configuración se queda.
|
|
62
|
+
|
|
38
63
|
### Enlazar
|
|
39
64
|
|
|
40
65
|
Al iniciarse, el navegador abre una página local con un código QR. Escanéalo con la cámara del teléfono: se abre la app Pendi y te pide confirmar el enlace. La página muestra cuando el enlace quedó hecho.
|
|
@@ -67,10 +92,18 @@ Licencia: MIT
|
|
|
67
92
|
|
|
68
93
|
## English
|
|
69
94
|
|
|
70
|
-
A small Windows
|
|
95
|
+
A small program for **Windows and Mac** that alerts your phone when your match is found and when it starts.
|
|
71
96
|
It links once to your Pendi account by scanning a QR code, with no new account of any kind.
|
|
72
97
|
It is free, needs no administrator rights and only uses Python.
|
|
73
98
|
|
|
99
|
+
**New: Mac support.** It works with the League of Legends client and with the **Teamfight Tactics** app for Mac, and in that app it accepts the match for you with an automatic click. It installs with one line in the Terminal: see [macOS](#macos-1).
|
|
100
|
+
|
|
101
|
+

|
|
102
|
+
|
|
103
|
+
How an alert arrives: the program waits for the game client, detects the match and sends the alert to your account.
|
|
104
|
+
|
|
105
|
+

|
|
106
|
+
|
|
74
107
|
### Install
|
|
75
108
|
|
|
76
109
|
Press Windows + R, paste this whole line and press Enter. It also works in PowerShell or the Command Prompt.
|
|
@@ -100,6 +133,23 @@ This way leaves no shortcut on the Desktop or in the Start menu, and the start w
|
|
|
100
133
|
|
|
101
134
|
The program checks PyPI every six hours and, when a newer version exists, installs it in the background. The page then offers «Restart now» to start using it. If the install fails, the page offers «Try again» in either mode and, the first time a version fails, the next check comes ten minutes later. To turn this off, start it with `--no-update` or write `"update": "off"` in `%APPDATA%\pendify\config.json`. Automatic updates install for your user (--user).
|
|
102
135
|
|
|
136
|
+
### macOS
|
|
137
|
+
|
|
138
|
+
PendiFy also runs on a Mac (Apple Silicon or Intel) with League of Legends / TFT installed. Open the Terminal app, paste this line and press Enter:
|
|
139
|
+
|
|
140
|
+
curl -fsSL https://raw.githubusercontent.com/ElkinDev/PendiFy/main/install.sh | bash
|
|
141
|
+
|
|
142
|
+
The installer looks for Python 3.10 or newer (with none and Homebrew present, it installs `python@3.12`), installs PendiFy in its own environment in `~/Library/Application Support/pendify/venv`, makes the `PendiFy` app in `~/Applications` (find it with Spotlight or in Launchpad) and starts it. To update, paste the same line again.
|
|
143
|
+
|
|
144
|
+
- Start: open `PendiFy` from Spotlight or Launchpad; if it already runs, its page opens.
|
|
145
|
+
- Stop: press "Quit" on the page, or in the menu of the PendiFy icon in the menu bar, at the top right.
|
|
146
|
+
- Menu bar icon: a click on the PendiFy icon at the top right of the screen opens a menu that opens the page, pauses or resumes the alerts and quits the program, also with the page and the browser closed. There is no Dock icon.
|
|
147
|
+
- Start with macOS: the page's "Start with macOS" switch makes a LaunchAgent for your user only, with no administrator rights.
|
|
148
|
+
- Config: `~/Library/Application Support/pendify/config.json`; the program's log is `pendify.log` in that same folder.
|
|
149
|
+
- Sound: the alert plays the system's sounds.
|
|
150
|
+
- Teamfight Tactics app: if you play TFT with its own app (no League client), PendiFy reads the game's log and alerts your phone when the match is found and when it starts. That app offers no way to accept from outside; with the page's "Accept the match automatically" switch, on by default, PendiFy brings TFT to the front and clicks Accept for you (macOS asks once for the Accessibility permission in System Settings > Privacy & Security > Accessibility). With the League client it is accepted for you, as on Windows.
|
|
151
|
+
- Uninstall: `curl -fsSL https://raw.githubusercontent.com/ElkinDev/PendiFy/main/uninstall.sh | bash`. It removes the app, the start with macOS and the environment; the config is kept.
|
|
152
|
+
|
|
103
153
|
### Link
|
|
104
154
|
|
|
105
155
|
When it starts, the browser opens a local page with a QR code. Scan it with the phone's camera: the Pendi app opens and asks you to confirm the link. The page shows when the link is done.
|
|
@@ -143,3 +193,17 @@ The second sends one alert with the stored pair and prints one line with the ans
|
|
|
143
193
|
Both commands take `--data-dir <dir>`, used instead of `%APPDATA%` (the config file lives in a folder under it), and `--worker <address>`, used instead of the pairing service's address and accepted only as `http://127.0.0.1:<port>` or `http://localhost:<port>`, so a test run never reaches the real service. `--client-lockfile <file>` replaces the game client's lockfile, with no read of the running processes, and the client it names is reached over plain http on 127.0.0.1, so a test run never reaches a real client.
|
|
144
194
|
|
|
145
195
|
python -m unittest discover -s tests -v
|
|
196
|
+
|
|
197
|
+
### Releasing the macOS app
|
|
198
|
+
|
|
199
|
+
`install.sh` downloads `PendiFy.app` prebuilt, signed with the Developer ID of team BL4KZH338B and notarized by Apple, so that on any Mac the Login Items list and the permission prompts name the developer. It builds the app on the Mac instead while no release is published, when a check of the download (its sha256, its signature, its team) fails, or with `PENDIFY_BUILD_APP=1`. A release is made on the maintainer's Mac, whose login keychain holds the Developer ID Application identity of that team.
|
|
200
|
+
|
|
201
|
+
Once, store the notary credentials in the keychain under the profile `PendiFy`; the command asks for an app-specific password made for it in the Apple Account settings:
|
|
202
|
+
|
|
203
|
+
xcrun notarytool store-credentials PendiFy --apple-id <apple id> --team-id BL4KZH338B
|
|
204
|
+
|
|
205
|
+
Then, for each release, from a commit that is pushed, with no other change in the tree and `gh` signed in:
|
|
206
|
+
|
|
207
|
+
tools/release-macos-app.sh
|
|
208
|
+
|
|
209
|
+
It builds the app as `install.sh` builds it, signs it with the hardened runtime and a secure timestamp, has Apple notarize it, staples the ticket, publishes the zip as the GitHub release `macos-app-<version>` (the version in `pyproject.toml`, one release per version) and writes the zip's URL and sha256 into `install.sh`. Commit and push `install.sh` after the release: installs download the new app only once that `install.sh` is on `main`. `NOTARY_PROFILE` names another profile, and `tools/release-macos-app.sh --no-publish` only builds and signs the app into `build/macos-app`, with no notarization, no release and no change to `install.sh`.
|
|
@@ -4,16 +4,17 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pendify"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.14"
|
|
8
8
|
description = "Pairs this PC with a phone account by a QR on a loopback page and sends it two kinds of alerts."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
11
11
|
license-files = ["LICENSE"]
|
|
12
12
|
requires-python = ">=3.10"
|
|
13
13
|
dependencies = []
|
|
14
|
-
keywords = ["notifications", "alerts", "phone", "qr", "pairing", "windows"]
|
|
14
|
+
keywords = ["notifications", "alerts", "phone", "qr", "pairing", "windows", "macos"]
|
|
15
15
|
classifiers = [
|
|
16
16
|
"Operating System :: Microsoft :: Windows",
|
|
17
|
+
"Operating System :: MacOS",
|
|
17
18
|
"Programming Language :: Python :: 3",
|
|
18
19
|
"Programming Language :: Python :: 3 :: Only",
|
|
19
20
|
]
|
|
@@ -24,4 +25,4 @@ Source = "https://github.com/ElkinDev/PendiFy"
|
|
|
24
25
|
|
|
25
26
|
# pip lays the icon beside the modules; install.ps1 points the shortcuts at it.
|
|
26
27
|
[tool.setuptools.package-data]
|
|
27
|
-
pendify = ["*.ico"]
|
|
28
|
+
pendify = ["*.ico", "macos/PendiFy"]
|
|
@@ -8,13 +8,15 @@
|
|
|
8
8
|
python -m <package> ping <kind> one alert with the stored pair, one fixed line per answer
|
|
9
9
|
|
|
10
10
|
The page and the watcher stop together on Ctrl+C, on Ctrl+Break, on the page's quit button and on the quit of
|
|
11
|
-
the icon by the clock, which remove the run file and exit 0. One instance per config
|
|
12
|
-
opens the running page and exits 0, and one made while that program is still closing
|
|
11
|
+
the icon by the clock (in the menu bar on macOS), which remove the run file and exit 0. One instance per config
|
|
12
|
+
folder: a second start opens the running page and exits 0, and one made while that program is still closing
|
|
13
|
+
after its quit waits for
|
|
13
14
|
it to end and starts. A start of a newer version over a running older copy replaces it: the older copy is asked to
|
|
14
15
|
stop through its page's /replace with the run file's secret, or ended by its pid when it has no secret or its page
|
|
15
16
|
does not answer, and this start then claims the run file as a first one does. A restart the page asks for
|
|
16
17
|
(«Reiniciar ahora», once a newer version is installed, or the
|
|
17
|
-
icon's «Reiniciar para actualizar»)
|
|
18
|
+
icon's «Reiniciar para actualizar»), and the one asked on macOS once the Accessibility permission is granted while
|
|
19
|
+
this copy runs, starts a new copy once the run file is released: without --quiet, so its page
|
|
18
20
|
opens, and with the --dry, --data-dir, --worker and --client-lockfile of this one.
|
|
19
21
|
Where no console is attached (a pythonw start), the line a start ends on is also shown in a
|
|
20
22
|
message box. `--data-dir`, `--worker` and `--client-lockfile` are the
|
|
@@ -33,9 +35,10 @@ import urllib.request
|
|
|
33
35
|
import webbrowser
|
|
34
36
|
from pathlib import Path
|
|
35
37
|
|
|
36
|
-
from . import alert, client, config, page, pairing, runfile, update, watcher, worker
|
|
38
|
+
from . import alert, autoclick, client, config, page, pairing, runfile, tft_app, update, watcher, worker
|
|
37
39
|
from .autostart import Autostart
|
|
38
40
|
from .tray import Tray
|
|
41
|
+
from .tray_macos import MenuBarIcon
|
|
39
42
|
|
|
40
43
|
TICK_SECONDS = 1.0
|
|
41
44
|
STOP_SECONDS = 5.0
|
|
@@ -52,6 +55,12 @@ PAGE_NOT_KNOWN_LINE = ("already running: the page of the program that runs is no
|
|
|
52
55
|
CLAIM_FAILED_LINE = "cannot start: the run file cannot be replaced: {path}"
|
|
53
56
|
FOLDER_FAILED_LINE = "cannot start: the config folder cannot be written: {path}"
|
|
54
57
|
RESTART_FAILED_LINE = "cannot restart: the new copy did not start; start the program again"
|
|
58
|
+
# Set only on the copy the Accessibility permission's grant restarts, through PendiFy.app's launcher, which keeps the
|
|
59
|
+
# environment: that copy never asks for such a restart itself, so two answers of macOS that disagree loop no restart.
|
|
60
|
+
GRANT_RESTART_ENV = "PENDIFY_GRANT_RESTART"
|
|
61
|
+
# Said by that copy when its own start still reads the permission not granted, the case that would have looped.
|
|
62
|
+
GRANT_RESTART_UNGRANTED_LINE = ("autoaccept: this copy was started by the restart for the Accessibility permission, "
|
|
63
|
+
"which still reads not granted; no further restart is asked")
|
|
55
64
|
# The line a start that replaced an older copy shows, in the page's language: the older copy's version, «desconocida»
|
|
56
65
|
# or "unknown" for a record with none, then this one's.
|
|
57
66
|
REPLACED_LINES = {"es": "Se reemplazó la copia anterior ({old}) por esta ({new}).",
|
|
@@ -67,7 +76,8 @@ _MB_SETFOREGROUND = 0x10000
|
|
|
67
76
|
# The restart's new copy: no console, its own process group, out of this one's.
|
|
68
77
|
_DETACHED_PROCESS = 0x00000008
|
|
69
78
|
_CREATE_NEW_PROCESS_GROUP = 0x00000200
|
|
70
|
-
# The icon by the clock
|
|
79
|
+
# The icon's picture, by the clock and in the menu bar: pendify.ico beside the modules, the file install.ps1 points
|
|
80
|
+
# the shortcuts at.
|
|
71
81
|
ICON_PATH = Path(__file__).with_name("pendify.ico")
|
|
72
82
|
|
|
73
83
|
|
|
@@ -140,6 +150,9 @@ def _watcher(args, store, state, base, timeout, stop, delay, beep):
|
|
|
140
150
|
lockfile = getattr(args, "client_lockfile", None)
|
|
141
151
|
if lockfile is None:
|
|
142
152
|
credentials, addresses = client.ClientCredentials(), client.real_addresses
|
|
153
|
+
if client.IS_MAC: # with no League client, the standalone TFT app read from its log
|
|
154
|
+
credentials = tft_app.EitherClient(credentials, tft_app.AppSession(
|
|
155
|
+
autoaccept=store.read_autoaccept, clicker=autoclick.Clicker()))
|
|
143
156
|
else:
|
|
144
157
|
credentials, addresses = client.ClientCredentials((str(lockfile),), run=None), client.loopback_addresses
|
|
145
158
|
alerter = alert.Alerter(store, state, lambda link_id, secret, kind: worker.ping(
|
|
@@ -180,18 +193,23 @@ def _ends(line, code, show):
|
|
|
180
193
|
return code
|
|
181
194
|
|
|
182
195
|
|
|
183
|
-
def _restart(args, spawn, show, opens_page):
|
|
196
|
+
def _restart(args, spawn, show, opens_page, granted=False):
|
|
184
197
|
"""The restart asked for, once the run file is free: a new copy of this program, detached and with no console,
|
|
185
198
|
which claims the run file as a first start does. One that opens its page, as every restart asked today does,
|
|
186
199
|
goes without --quiet; one that does not keeps this run's --quiet. This run's --dry, --data-dir, --worker and
|
|
187
|
-
--client-lockfile go with it either way."""
|
|
188
|
-
|
|
200
|
+
--client-lockfile go with it either way, and GRANT_RESTART_ENV only with the one the permission's grant asked."""
|
|
201
|
+
app = os.environ.get("PENDIFY_APP") if sys.platform == "darwin" else None # through PendiFy.app's launcher
|
|
202
|
+
command = ([app] if app else [sys.executable, "-m", __package__])
|
|
203
|
+
command += ["--quiet"] if args.quiet and not opens_page else []
|
|
189
204
|
command += ["--dry"] if args.dry else []
|
|
190
205
|
for option in ("data_dir", "worker", "client_lockfile"):
|
|
191
206
|
if hasattr(args, option): # the parser's SUPPRESS: present only when this run was given it
|
|
192
207
|
command += ["--" + option.replace("_", "-"), str(getattr(args, option))]
|
|
193
208
|
try:
|
|
194
|
-
|
|
209
|
+
detached = ({"creationflags": _DETACHED_PROCESS | _CREATE_NEW_PROCESS_GROUP} if os.name == "nt"
|
|
210
|
+
else {"start_new_session": True}) # Popen refuses creationflags off Windows
|
|
211
|
+
marker = {"env": {**os.environ, GRANT_RESTART_ENV: "1"}} if granted else {}
|
|
212
|
+
spawn(command, **detached, **marker, close_fds=True)
|
|
195
213
|
except OSError:
|
|
196
214
|
return _ends(RESTART_FAILED_LINE, 1, show)
|
|
197
215
|
return 0
|
|
@@ -263,11 +281,13 @@ def _ready_version(updater):
|
|
|
263
281
|
|
|
264
282
|
|
|
265
283
|
def _serve(args, store, base, timeout, opener, stop, delay, beep, show, clock, sleep, autostart, tray, updater,
|
|
266
|
-
spawn, terminate):
|
|
284
|
+
spawn, terminate, switch):
|
|
267
285
|
# A quiet start is the system's, at logon: it never opens the browser, and a start that ends well shows no box.
|
|
268
286
|
calm = (lambda line: None) if args.quiet else show
|
|
269
287
|
run = runfile.RunFile(store.path.parent, clock=clock, sleep=sleep)
|
|
270
288
|
replaced = None # the record of the older copy this start replaced
|
|
289
|
+
# Read once and dropped, so no later restart of this copy inherits it.
|
|
290
|
+
restarted_for_grant = os.environ.pop(GRANT_RESTART_ENV, None) == "1"
|
|
271
291
|
try:
|
|
272
292
|
holder = run.claim()
|
|
273
293
|
if holder is not None and holder["closing"] and run.wait_released(holder, CLOSING_WAIT_SECONDS):
|
|
@@ -293,7 +313,7 @@ def _serve(args, store, base, timeout, opener, stop, delay, beep, show, clock, s
|
|
|
293
313
|
opener(f"http://{page.ADDRESS}:{port}/")
|
|
294
314
|
show(ALREADY_RUNNING_LINE)
|
|
295
315
|
return 0
|
|
296
|
-
updating = None
|
|
316
|
+
updating, granted = None, threading.Event() # set once the restart asked is the permission grant's
|
|
297
317
|
try:
|
|
298
318
|
mode = update.OFF if args.no_update else store.read_update()
|
|
299
319
|
state = pairing.PairingState(store, lambda secret: worker.check(secret, base=base, timeout=timeout))
|
|
@@ -309,16 +329,37 @@ def _serve(args, store, base, timeout, opener, stop, delay, beep, show, clock, s
|
|
|
309
329
|
pass # unmarked, the finally marks it again; the stop goes on
|
|
310
330
|
stop.set()
|
|
311
331
|
|
|
332
|
+
def restart_granted():
|
|
333
|
+
# The Accessibility permission granted while this copy runs, which macOS keeps answering it as at its
|
|
334
|
+
# start: a new copy reads it, its page opened, as the person is likely in System Settings and this
|
|
335
|
+
# page's tab goes with this copy. Refused before the update exists and once this copy stops.
|
|
336
|
+
if updating is None or stop.is_set():
|
|
337
|
+
return False
|
|
338
|
+
granted.set()
|
|
339
|
+
updating.restart(opens_page=True)
|
|
340
|
+
return True
|
|
341
|
+
|
|
342
|
+
if switch is None: # the real switch, never in a test run, where macOS would be asked for the permission
|
|
343
|
+
switch = autoclick.Switch if getattr(args, "client_lockfile", None) is None else None
|
|
344
|
+
# A copy that grant restarted still asks for the permission and says it, but never asks that restart again.
|
|
345
|
+
clicking = (switch(store, restart=None if restarted_for_grant else restart_granted) if switch is not None
|
|
346
|
+
else None)
|
|
347
|
+
if clicking is not None and clicking.available and clicking.enabled():
|
|
348
|
+
# On by default: the permission is asked for at the start, not at the first pop.
|
|
349
|
+
if not clicking.ask() and restarted_for_grant:
|
|
350
|
+
print(GRANT_RESTART_UNGRANTED_LINE, flush=True)
|
|
312
351
|
pairing_page = page.PairingPage(state, watch=watch.snapshot, on_quit=quit_page, on_pause=watch.pause,
|
|
313
|
-
on_resume=watch.resume, autostart=autostart, events=watch.events
|
|
352
|
+
on_resume=watch.resume, autostart=autostart, events=watch.events,
|
|
353
|
+
autoaccept=clicking)
|
|
314
354
|
pairing_page.run = run # its /replace answers the secret the publish below writes
|
|
315
355
|
url = pairing_page.start()
|
|
316
356
|
# The update's rounds on their own thread (update.py), built once the page serves; its restart is the
|
|
317
357
|
# page's quit, after the flag read below once the run file is free; pip's output goes to the config folder.
|
|
318
358
|
updating = updater(update.RUNNING_VERSION, mode, restart=quit_page, folder=store.path.parent)
|
|
319
359
|
pairing_page.updater = updating
|
|
320
|
-
# The icon by the clock, under --quiet as well: the way to stop a copy the Run key
|
|
321
|
-
# the page's, in the language the page resolves with no browser to
|
|
360
|
+
# The icon by the clock, or in the menu bar on macOS, under --quiet as well: the way to stop a copy the Run key
|
|
361
|
+
# or the LaunchAgent started. Its words are the page's, in the language the page resolves with no browser to
|
|
362
|
+
# ask: the kept choice, else Spanish.
|
|
322
363
|
icon = tray(url, on_open=lambda: opener(url), on_pause=watch.pause, on_resume=watch.resume,
|
|
323
364
|
on_quit=quit_page, paused=lambda: watch.paused,
|
|
324
365
|
words=lambda: page.WORDS[pairing_page.language_of(None)], icon_path=ICON_PATH,
|
|
@@ -342,13 +383,17 @@ def _serve(args, store, base, timeout, opener, stop, delay, beep, show, clock, s
|
|
|
342
383
|
watching.start()
|
|
343
384
|
while True:
|
|
344
385
|
state.tick()
|
|
345
|
-
|
|
386
|
+
# The icon's wait, the stop's own on Windows; on macOS it pumps AppKit's events on this, the main
|
|
387
|
+
# thread, where the menu bar's icon lives.
|
|
388
|
+
if icon.wait(stop, TICK_SECONDS):
|
|
346
389
|
break
|
|
347
390
|
except KeyboardInterrupt:
|
|
348
391
|
pass
|
|
349
392
|
finally:
|
|
350
393
|
stop.set()
|
|
351
394
|
updating.close() # the restart gate shuts at the quit
|
|
395
|
+
if clicking is not None:
|
|
396
|
+
clicking.close() # and the wait for the permission's grant ends
|
|
352
397
|
# First, so a start made while this one stops waits for it instead of opening a closing page: Ctrl+C
|
|
353
398
|
# and Ctrl+Break are marked only here, and the page's quit, marked already, is marked again.
|
|
354
399
|
try:
|
|
@@ -366,10 +411,15 @@ def _serve(args, store, base, timeout, opener, stop, delay, beep, show, clock, s
|
|
|
366
411
|
finally:
|
|
367
412
|
run.release()
|
|
368
413
|
if updating is not None and updating.restart_requested.is_set():
|
|
369
|
-
return _restart(args, spawn, show, updating.restart_opens_page)
|
|
414
|
+
return _restart(args, spawn, show, updating.restart_opens_page, granted.is_set())
|
|
370
415
|
return 0
|
|
371
416
|
|
|
372
417
|
|
|
418
|
+
def _icon_kind(platform):
|
|
419
|
+
"""The icon of this platform: in the menu bar on macOS, by the clock on Windows (and none elsewhere, said)."""
|
|
420
|
+
return MenuBarIcon if platform == "darwin" else Tray
|
|
421
|
+
|
|
422
|
+
|
|
373
423
|
def _break_as_interrupt():
|
|
374
424
|
"""Ctrl+Break stops the program as Ctrl+C does; only on Windows and only on the main thread."""
|
|
375
425
|
if not hasattr(signal, "SIGBREAK") or threading.current_thread() is not threading.main_thread():
|
|
@@ -379,14 +429,17 @@ def _break_as_interrupt():
|
|
|
379
429
|
|
|
380
430
|
def main(argv=None, *, opener=webbrowser.open, stop=None, timeout=worker.TIMEOUT_SECONDS, delay=None,
|
|
381
431
|
beep=alert.beep, box=_message_box, autostart=None, console=_console_attached, clock=time.monotonic,
|
|
382
|
-
sleep=time.sleep, tray=
|
|
432
|
+
sleep=time.sleep, tray=_icon_kind(sys.platform), updater=update.Updater, spawn=subprocess.Popen,
|
|
433
|
+
terminate=runfile.terminate, switch=None):
|
|
383
434
|
"""`beep`, `box` and `autostart` are the seams of the sound, of the message box and of the start with Windows
|
|
384
435
|
(the per-user Run value when None): a test run passes silent ones and a fake. `console` says whether a printed
|
|
385
|
-
line reaches anybody; `clock` and `sleep` time the run file's re-reads. `tray` makes the icon by the clock,
|
|
386
|
-
seam a test run fills with a fake, so no test shows a real icon. `updater` makes
|
|
387
|
-
the restart's new copy, the seams a test run fills with fakes, so no test reaches
|
|
388
|
-
copy. `terminate` ends an older copy by its pid when it cannot be asked to stop,
|
|
389
|
-
no test ends a process.
|
|
436
|
+
line reaches anybody; `clock` and `sleep` time the run file's re-reads. `tray` makes the icon by the clock, or
|
|
437
|
+
in the menu bar on macOS, the seam a test run fills with a fake, so no test shows a real icon. `updater` makes
|
|
438
|
+
the update and `spawn` starts the restart's new copy, the seams a test run fills with fakes, so no test reaches
|
|
439
|
+
PyPI, runs pip or starts a copy. `terminate` ends an older copy by its pid when it cannot be asked to stop,
|
|
440
|
+
the seam every test run fakes, so no test ends a process. `switch` makes the page's switch of the click on
|
|
441
|
+
accept (autoclick.Switch when None, and none under --client-lockfile), the seam a test run fills with a fake, so
|
|
442
|
+
no test asks macOS for a permission."""
|
|
390
443
|
args = _arguments(sys.argv[1:] if argv is None else argv)
|
|
391
444
|
store = config.ConfigStore(getattr(args, "data_dir", None) or config.default_base_dir())
|
|
392
445
|
base = getattr(args, "worker", worker.BASE_URL)
|
|
@@ -402,7 +455,8 @@ def main(argv=None, *, opener=webbrowser.open, stop=None, timeout=worker.TIMEOUT
|
|
|
402
455
|
try:
|
|
403
456
|
return _serve(args, store, base, timeout, opener, stop or threading.Event(),
|
|
404
457
|
delay or watcher.accept_delay, beep, show, clock, sleep,
|
|
405
|
-
autostart if autostart is not None else Autostart(), tray, updater, spawn, terminate
|
|
458
|
+
autostart if autostart is not None else Autostart(), tray, updater, spawn, terminate,
|
|
459
|
+
switch)
|
|
406
460
|
finally:
|
|
407
461
|
if previous is not None:
|
|
408
462
|
signal.signal(signal.SIGBREAK, previous)
|
|
@@ -6,6 +6,8 @@ for the page as the last ping. With no link id nothing is sent and nothing is qu
|
|
|
6
6
|
alone, with no kind and no ping. The console gets fixed lines only. listen() names the one callback told each ping's
|
|
7
7
|
result name and time right after they are recorded (the watcher's log, lane pclog).
|
|
8
8
|
"""
|
|
9
|
+
import subprocess
|
|
10
|
+
import sys
|
|
9
11
|
import threading
|
|
10
12
|
import time
|
|
11
13
|
|
|
@@ -13,7 +15,7 @@ from . import worker
|
|
|
13
15
|
|
|
14
16
|
try:
|
|
15
17
|
import winsound
|
|
16
|
-
except ImportError: # not Windows: the beep is silent, as in the script
|
|
18
|
+
except ImportError: # not Windows: system sounds on macOS, else the beep is silent, as in the script
|
|
17
19
|
winsound = None
|
|
18
20
|
|
|
19
21
|
BEEP_NOTES = (988, 1319) # S:167
|
|
@@ -23,6 +25,28 @@ PING_LINES = {"sent": "alert: sent to the phone", "refused": "alert: refused, li
|
|
|
23
25
|
"not_delivered": "alert: not delivered", "failed": "alert: failed"}
|
|
24
26
|
CONFIG_UNREADABLE_LINE = "alert: the config file could not be read, nothing was sent"
|
|
25
27
|
BEEP_FAILED_LINE = "alert: the sound device refused the beep"
|
|
28
|
+
# macOS has no winsound: each note of the siren is a short system sound, the low one Tink, the high one Glass.
|
|
29
|
+
MAC_SOUNDS = ("/System/Library/Sounds/Tink.aiff", "/System/Library/Sounds/Glass.aiff")
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class MacSound:
|
|
33
|
+
"""winsound's Beep on macOS, played by afplay, so the siren keeps its two-note shape. A missing afplay or sound
|
|
34
|
+
fails as winsound does, with RuntimeError."""
|
|
35
|
+
|
|
36
|
+
def __init__(self, run=subprocess.run):
|
|
37
|
+
self._run = run
|
|
38
|
+
|
|
39
|
+
def Beep(self, frequency, milliseconds): # noqa: N802, winsound's own name
|
|
40
|
+
path = MAC_SOUNDS[0] if frequency < max(BEEP_NOTES) else MAC_SOUNDS[1]
|
|
41
|
+
try:
|
|
42
|
+
self._run(["/usr/bin/afplay", path], stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL,
|
|
43
|
+
stderr=subprocess.DEVNULL, timeout=5, check=True)
|
|
44
|
+
except (OSError, subprocess.SubprocessError):
|
|
45
|
+
raise RuntimeError("afplay could not play the sound") from None
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
if winsound is None and sys.platform == "darwin":
|
|
49
|
+
winsound = MacSound()
|
|
26
50
|
|
|
27
51
|
|
|
28
52
|
def _print(line):
|