pendify 0.1.11__tar.gz → 0.1.12__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.
Files changed (29) hide show
  1. {pendify-0.1.11/src/pendify.egg-info → pendify-0.1.12}/PKG-INFO +3 -3
  2. {pendify-0.1.11 → pendify-0.1.12}/README.md +2 -2
  3. {pendify-0.1.11 → pendify-0.1.12}/pyproject.toml +1 -1
  4. {pendify-0.1.11 → pendify-0.1.12}/src/pendify/page.py +8 -4
  5. {pendify-0.1.11 → pendify-0.1.12}/src/pendify/update.py +35 -20
  6. {pendify-0.1.11 → pendify-0.1.12/src/pendify.egg-info}/PKG-INFO +3 -3
  7. {pendify-0.1.11 → pendify-0.1.12}/LICENSE +0 -0
  8. {pendify-0.1.11 → pendify-0.1.12}/MANIFEST.in +0 -0
  9. {pendify-0.1.11 → pendify-0.1.12}/setup.cfg +0 -0
  10. {pendify-0.1.11 → pendify-0.1.12}/src/pendify/__init__.py +0 -0
  11. {pendify-0.1.11 → pendify-0.1.12}/src/pendify/__main__.py +0 -0
  12. {pendify-0.1.11 → pendify-0.1.12}/src/pendify/alert.py +0 -0
  13. {pendify-0.1.11 → pendify-0.1.12}/src/pendify/autostart.py +0 -0
  14. {pendify-0.1.11 → pendify-0.1.12}/src/pendify/client.py +0 -0
  15. {pendify-0.1.11 → pendify-0.1.12}/src/pendify/codes.py +0 -0
  16. {pendify-0.1.11 → pendify-0.1.12}/src/pendify/config.py +0 -0
  17. {pendify-0.1.11 → pendify-0.1.12}/src/pendify/icon.py +0 -0
  18. {pendify-0.1.11 → pendify-0.1.12}/src/pendify/pairing.py +0 -0
  19. {pendify-0.1.11 → pendify-0.1.12}/src/pendify/pendify.ico +0 -0
  20. {pendify-0.1.11 → pendify-0.1.12}/src/pendify/plate_almena.py +0 -0
  21. {pendify-0.1.11 → pendify-0.1.12}/src/pendify/qr.py +0 -0
  22. {pendify-0.1.11 → pendify-0.1.12}/src/pendify/runfile.py +0 -0
  23. {pendify-0.1.11 → pendify-0.1.12}/src/pendify/sponsor_art.py +0 -0
  24. {pendify-0.1.11 → pendify-0.1.12}/src/pendify/tray.py +0 -0
  25. {pendify-0.1.11 → pendify-0.1.12}/src/pendify/watcher.py +0 -0
  26. {pendify-0.1.11 → pendify-0.1.12}/src/pendify/worker.py +0 -0
  27. {pendify-0.1.11 → pendify-0.1.12}/src/pendify.egg-info/SOURCES.txt +0 -0
  28. {pendify-0.1.11 → pendify-0.1.12}/src/pendify.egg-info/dependency_links.txt +0 -0
  29. {pendify-0.1.11 → pendify-0.1.12}/src/pendify.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pendify
3
- Version: 0.1.11
3
+ Version: 0.1.12
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
@@ -49,7 +49,7 @@ Si Windows responde que no encuentra `python`, usa `py` en su lugar: `py -m pip
49
49
 
50
50
  Así no se crean los accesos directos en el Escritorio ni en el menú Inicio, y el inicio con Windows queda en el interruptor de la página. Para actualizar, pulsa «Salir» en la página, ejecuta otra vez la misma línea de pip y vuelve a iniciarlo. Para quitarlo, apaga primero el interruptor «Iniciar con Windows» en la página, pulsa «Salir» y después ejecuta `python -m pip uninstall pendify`. La configuración en `%APPDATA%\pendify`, con el enlace con el teléfono, se queda; puedes borrar esa carpeta a mano.
51
51
 
52
- 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. 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).
52
+ 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
53
 
54
54
  ### Enlazar
55
55
 
@@ -114,7 +114,7 @@ If Windows answers that `python` was not found, use `py` in its place: `py -m pi
114
114
 
115
115
  This way leaves no shortcut on the Desktop or in the Start menu, and the start with Windows is the switch on the page. To update, press «Quit» on the page, run the same pip line again and start it again. To remove it, first turn off the «Start with Windows» switch on the page, press «Quit», then run `python -m pip uninstall pendify`. The configuration in `%APPDATA%\pendify`, with the link to the phone, stays; you can delete that folder by hand.
116
116
 
117
- 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. 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).
117
+ 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
118
 
119
119
  ### Link
120
120
 
@@ -33,7 +33,7 @@ Si Windows responde que no encuentra `python`, usa `py` en su lugar: `py -m pip
33
33
 
34
34
  Así no se crean los accesos directos en el Escritorio ni en el menú Inicio, y el inicio con Windows queda en el interruptor de la página. Para actualizar, pulsa «Salir» en la página, ejecuta otra vez la misma línea de pip y vuelve a iniciarlo. Para quitarlo, apaga primero el interruptor «Iniciar con Windows» en la página, pulsa «Salir» y después ejecuta `python -m pip uninstall pendify`. La configuración en `%APPDATA%\pendify`, con el enlace con el teléfono, se queda; puedes borrar esa carpeta a mano.
35
35
 
36
- 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. 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).
36
+ 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
37
 
38
38
  ### Enlazar
39
39
 
@@ -98,7 +98,7 @@ If Windows answers that `python` was not found, use `py` in its place: `py -m pi
98
98
 
99
99
  This way leaves no shortcut on the Desktop or in the Start menu, and the start with Windows is the switch on the page. To update, press «Quit» on the page, run the same pip line again and start it again. To remove it, first turn off the «Start with Windows» switch on the page, press «Quit», then run `python -m pip uninstall pendify`. The configuration in `%APPDATA%\pendify`, with the link to the phone, stays; you can delete that folder by hand.
100
100
 
101
- 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. 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).
101
+ 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
102
 
103
103
  ### Link
104
104
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "pendify"
7
- version = "0.1.11"
7
+ version = "0.1.12"
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"
@@ -133,6 +133,7 @@ WORDS = {
133
133
  "update_ready": "Actualización lista: {version}. Se aplica al reiniciar.",
134
134
  "update_restart": "Reiniciar ahora",
135
135
  "update_failed": "No se pudo instalar la versión {version}",
136
+ "update_retry": "Reintentar",
136
137
  "update_restarting": "Reiniciando. La página nueva se abre en unos segundos.",
137
138
  "update_tray_restart": "Reiniciar para actualizar a {version}",
138
139
  },
@@ -224,6 +225,7 @@ WORDS = {
224
225
  "update_ready": "Update ready: {version}. It applies on restart.",
225
226
  "update_restart": "Restart now",
226
227
  "update_failed": "Version {version} could not be installed",
228
+ "update_retry": "Try again",
227
229
  "update_restarting": "Restarting. The new page opens in a few seconds.",
228
230
  "update_tray_restart": "Restart to update to {version}",
229
231
  },
@@ -1044,8 +1046,8 @@ class PairingPage:
1044
1046
  def _update_line(self, words, token, seen):
1045
1047
  """The update's line under the state line and its one button, by state: a version seen in notify mode with
1046
1048
  «Actualizar», a version ready in either mode with «Reiniciar ahora», an install under way alone, a failed one
1047
- with pip's last line in its title; nothing for none, nor for a version auto mode is about to install.
1048
- `words` are escaped already."""
1049
+ with pip's last line in its title and «Reintentar», which posts /update as «Actualizar» does, in either mode;
1050
+ nothing for none, nor for a version auto mode is about to install. `words` are escaped already."""
1049
1051
  if seen is None:
1050
1052
  return []
1051
1053
  state, version = seen["state"], html.escape(seen["version"] or "")
@@ -1056,7 +1058,7 @@ class PairingPage:
1056
1058
  elif state == update.INSTALLING:
1057
1059
  key, button = "update_installing", None
1058
1060
  elif state == update.FAILED:
1059
- key, button = "update_failed", None
1061
+ key, button = "update_failed", ("update", "update_retry")
1060
1062
  else:
1061
1063
  return []
1062
1064
  failed = state == update.FAILED
@@ -1281,7 +1283,9 @@ def _handler(page):
1281
1283
  finally:
1282
1284
  page.updater.restart()
1283
1285
  return
1284
- if path == "/update": # «Actualizar» in notify mode; in any other mode or state nothing is installed
1286
+ # «Actualizar» in notify mode, and «Reintentar» after a failed install in either mode; in any other mode
1287
+ # or state nothing is installed.
1288
+ if path == "/update":
1285
1289
  page.updater.request_install()
1286
1290
  return self._send(303, "text/plain; charset=utf-8", "", (("Location", "/"),))
1287
1291
  if path == "/theme": # the page's script posts it and reads no page back
@@ -2,7 +2,9 @@
2
2
  installed with pip.
3
3
 
4
4
  `auto` checks and installs in the background, and the page then offers «Reiniciar ahora»; `notify` checks only, and
5
- the page offers «Actualizar», which installs and then restarts; `off` never checks. The check carries nothing of the
5
+ the page offers «Actualizar», which installs and then restarts; `off` never checks. A failed install is offered
6
+ again: auto mode's first failure of a version brings the next round ten minutes after, and the page offers
7
+ «Reintentar» in either mode. The check carries nothing of the
6
8
  pair: one GET to pypi.org with the program's User-Agent. pip runs with python.exe beside this interpreter, since the
7
9
  output of pythonw goes nowhere, with the arguments of the paste (install.ps1:184) and the version pinned, and never
8
10
  with a console over a game; its output goes to update-pip.log in the config folder, never to pipes of this copy, and
@@ -28,6 +30,8 @@ MODES = config.UPDATE_MODES
28
30
  AUTO, NOTIFY, OFF = MODES
29
31
  FIRST_ROUND_SECONDS = 60
30
32
  ROUND_SECONDS = 6 * 60 * 60
33
+ # The one early round after auto mode's first failed install of a version, for an index that lags PyPI's JSON.
34
+ RETRY_SECONDS = 10 * 60
31
35
  INSTALL_SECONDS = 10 * 60
32
36
  # How long main's stop waits for an install under way before the run file goes.
33
37
  INSTALL_JOIN_SECONDS = 60
@@ -136,6 +140,8 @@ class Updater:
136
140
  self._log = _log if log is None else log
137
141
  self._lock = threading.Lock()
138
142
  self._state = (NONE, None, None)
143
+ # The versions whose install failed once in a round of auto mode: each had its one early round.
144
+ self._retried = set()
139
145
  # Set while no install runs: what wait() reads; cleared under the lock wherever the state turns installing.
140
146
  self._idle = threading.Event()
141
147
  self._idle.set()
@@ -175,43 +181,52 @@ class Updater:
175
181
  return False
176
182
 
177
183
  def run(self):
178
- """One round a minute after the start, then one every six hours, until the close."""
184
+ """One round a minute after the start, then one every six hours, until the close; after a round in which
185
+ auto mode's install of a version failed for the first time, the next one comes ten minutes after, once for
186
+ that version."""
179
187
  delay = FIRST_ROUND_SECONDS
180
188
  while not self._wait(delay):
181
- self.round()
182
- delay = ROUND_SECONDS
189
+ delay = RETRY_SECONDS if self.round() else ROUND_SECONDS
183
190
 
184
191
  def round(self):
185
- """One check; a newer version reads available, and auto mode installs it at once. A failure is one log
186
- line, and the next round runs. Nothing is checked again once an install has started, ended ready or failed:
187
- a failed version is tried again at the next start only."""
192
+ """One check; a newer version reads available, and auto mode installs it at once. A failed install is open
193
+ too: when the check still names a newer version, auto mode installs it again and notify mode reads it
194
+ available, so the page offers «Actualizar» again. A failure is one log line, and the next round runs; a check
195
+ that fails or names nothing newer leaves the state as it is. Nothing is checked again once an install has
196
+ started or ended ready. True when auto mode's install of that version failed here for the first time, the
197
+ round run() brings ten minutes early; False otherwise."""
188
198
  if self.mode == OFF or not self._open():
189
- return
199
+ return False
190
200
  try:
191
201
  latest = self._check()
192
202
  except Exception as failure: # the network, PyPI or its answer: silent on the page until the next round
193
203
  self._log(f"the check failed: {type(failure).__name__}")
194
- return
204
+ return False
195
205
  if not newer(latest, self.current_version):
196
- return
206
+ return False
197
207
  with self._lock:
198
- if self._state[0] not in (NONE, AVAILABLE):
199
- return
208
+ if self._state[0] not in (NONE, AVAILABLE, FAILED):
209
+ return False
200
210
  self._state = (AVAILABLE, latest, None)
201
- if self.mode == AUTO:
202
- self._apply(latest)
211
+ if self.mode != AUTO or self._apply(latest):
212
+ return False
213
+ with self._lock:
214
+ first = latest not in self._retried
215
+ self._retried.add(latest)
216
+ return first
203
217
 
204
218
  def request_install(self):
205
- """The page's «Actualizar» in notify mode: the version seen installed on its own thread, then the restart.
206
- False, and nothing done, in any other mode or state."""
219
+ """The page's «Actualizar» in notify mode, and its «Reintentar» after a failed install in either mode: the
220
+ version installed on its own thread, then, in notify mode, the restart; in auto mode it reads ready and waits
221
+ for «Reiniciar ahora». False, and nothing done, in any other mode or state."""
207
222
  with self._lock:
208
223
  state, version, _ = self._state
209
- if self.mode != NOTIFY or state != AVAILABLE:
224
+ if state != FAILED and (self.mode != NOTIFY or state != AVAILABLE):
210
225
  return False
211
226
  self._state = (INSTALLING, version, None)
212
227
  self._idle.clear()
213
- threading.Thread(target=self._install_then_restart, args=(version,), name="update-install",
214
- daemon=True).start()
228
+ threading.Thread(target=self._install_then_restart if self.mode == NOTIFY else self._apply, args=(version,),
229
+ name="update-install", daemon=True).start()
215
230
  return True
216
231
 
217
232
  def restart(self, opens_page=True):
@@ -226,7 +241,7 @@ class Updater:
226
241
 
227
242
  def _open(self):
228
243
  with self._lock:
229
- return self._state[0] in (NONE, AVAILABLE)
244
+ return self._state[0] in (NONE, AVAILABLE, FAILED)
230
245
 
231
246
  def _pip(self, version):
232
247
  """pip itself, its output in update-pip.log of the config folder."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pendify
3
- Version: 0.1.11
3
+ Version: 0.1.12
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
@@ -49,7 +49,7 @@ Si Windows responde que no encuentra `python`, usa `py` en su lugar: `py -m pip
49
49
 
50
50
  Así no se crean los accesos directos en el Escritorio ni en el menú Inicio, y el inicio con Windows queda en el interruptor de la página. Para actualizar, pulsa «Salir» en la página, ejecuta otra vez la misma línea de pip y vuelve a iniciarlo. Para quitarlo, apaga primero el interruptor «Iniciar con Windows» en la página, pulsa «Salir» y después ejecuta `python -m pip uninstall pendify`. La configuración en `%APPDATA%\pendify`, con el enlace con el teléfono, se queda; puedes borrar esa carpeta a mano.
51
51
 
52
- 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. 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).
52
+ 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
53
 
54
54
  ### Enlazar
55
55
 
@@ -114,7 +114,7 @@ If Windows answers that `python` was not found, use `py` in its place: `py -m pi
114
114
 
115
115
  This way leaves no shortcut on the Desktop or in the Start menu, and the start with Windows is the switch on the page. To update, press «Quit» on the page, run the same pip line again and start it again. To remove it, first turn off the «Start with Windows» switch on the page, press «Quit», then run `python -m pip uninstall pendify`. The configuration in `%APPDATA%\pendify`, with the link to the phone, stays; you can delete that folder by hand.
116
116
 
117
- 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. 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).
117
+ 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
118
 
119
119
  ### Link
120
120
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes