cleepcli 1.44.2__tar.gz → 1.44.3__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 (32) hide show
  1. {cleepcli-1.44.2/cleepcli.egg-info → cleepcli-1.44.3}/PKG-INFO +1 -1
  2. {cleepcli-1.44.2 → cleepcli-1.44.3}/cleepcli/cleepapi.py +33 -0
  3. {cleepcli-1.44.2 → cleepcli-1.44.3}/cleepcli/version.py +1 -1
  4. {cleepcli-1.44.2 → cleepcli-1.44.3}/cleepcli/watch.py +34 -17
  5. {cleepcli-1.44.2 → cleepcli-1.44.3/cleepcli.egg-info}/PKG-INFO +1 -1
  6. {cleepcli-1.44.2 → cleepcli-1.44.3}/tests/test_watch.py +5 -0
  7. {cleepcli-1.44.2 → cleepcli-1.44.3}/LICENSE +0 -0
  8. {cleepcli-1.44.2 → cleepcli-1.44.3}/MANIFEST.in +0 -0
  9. {cleepcli-1.44.2 → cleepcli-1.44.3}/README.md +0 -0
  10. {cleepcli-1.44.2 → cleepcli-1.44.3}/bin/ccli +0 -0
  11. {cleepcli-1.44.2 → cleepcli-1.44.3}/bin/cleep-cli +0 -0
  12. {cleepcli-1.44.2 → cleepcli-1.44.3}/cleepcli/__init__.py +0 -0
  13. {cleepcli-1.44.2 → cleepcli-1.44.3}/cleepcli/check.py +0 -0
  14. {cleepcli-1.44.2 → cleepcli-1.44.3}/cleepcli/ci.py +0 -0
  15. {cleepcli-1.44.2 → cleepcli-1.44.3}/cleepcli/config.py +0 -0
  16. {cleepcli-1.44.2 → cleepcli-1.44.3}/cleepcli/console.py +0 -0
  17. {cleepcli-1.44.2 → cleepcli-1.44.3}/cleepcli/docs.py +0 -0
  18. {cleepcli-1.44.2 → cleepcli-1.44.3}/cleepcli/file.py +0 -0
  19. {cleepcli-1.44.2 → cleepcli-1.44.3}/cleepcli/git.py +0 -0
  20. {cleepcli-1.44.2 → cleepcli-1.44.3}/cleepcli/module.py +0 -0
  21. {cleepcli-1.44.2 → cleepcli-1.44.3}/cleepcli/package.py +0 -0
  22. {cleepcli-1.44.2 → cleepcli-1.44.3}/cleepcli/test.py +0 -0
  23. {cleepcli-1.44.2 → cleepcli-1.44.3}/cleepcli/tools.py +0 -0
  24. {cleepcli-1.44.2 → cleepcli-1.44.3}/cleepcli.egg-info/SOURCES.txt +0 -0
  25. {cleepcli-1.44.2 → cleepcli-1.44.3}/cleepcli.egg-info/dependency_links.txt +0 -0
  26. {cleepcli-1.44.2 → cleepcli-1.44.3}/cleepcli.egg-info/requires.txt +0 -0
  27. {cleepcli-1.44.2 → cleepcli-1.44.3}/cleepcli.egg-info/top_level.txt +0 -0
  28. {cleepcli-1.44.2 → cleepcli-1.44.3}/pyproject.toml +0 -0
  29. {cleepcli-1.44.2 → cleepcli-1.44.3}/requirements.txt +0 -0
  30. {cleepcli-1.44.2 → cleepcli-1.44.3}/setup.cfg +0 -0
  31. {cleepcli-1.44.2 → cleepcli-1.44.3}/setup.py +0 -0
  32. {cleepcli-1.44.2 → cleepcli-1.44.3}/tests/test_console.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cleepcli
3
- Version: 1.44.2
3
+ Version: 1.44.3
4
4
  Summary: Cleep-cli helps developers to build great Cleep applications from command line.
5
5
  Home-page: https://github.com/CleepDevice/cleep-cli
6
6
  Author: Tanguy Bonneau
@@ -243,6 +243,39 @@ class CleepApi():
243
243
  return False
244
244
  return True
245
245
 
246
+ def notify_sync_started(self):
247
+ """
248
+ Tell the developer UI a watch sync is starting.
249
+ """
250
+ data = {'to': 'developer', 'command': 'notify_sync_started'}
251
+ result = self.__post(self.command_url, data)
252
+ if not result or result[0] != 200:
253
+ self.logger.debug('Unable to notify sync started')
254
+ return False
255
+ return True
256
+
257
+ def notify_sync_done(self):
258
+ """
259
+ Tell the developer UI a watch sync finished without restart.
260
+ """
261
+ data = {'to': 'developer', 'command': 'notify_sync_done'}
262
+ result = self.__post(self.command_url, data)
263
+ if not result or result[0] != 200:
264
+ self.logger.debug('Unable to notify sync done')
265
+ return False
266
+ return True
267
+
268
+ def notify_sync_failed(self):
269
+ """
270
+ Tell the developer UI a watch sync failed.
271
+ """
272
+ data = {'to': 'developer', 'command': 'notify_sync_failed'}
273
+ result = self.__post(self.command_url, data)
274
+ if not result or result[0] != 200:
275
+ self.logger.debug('Unable to notify sync failed')
276
+ return False
277
+ return True
278
+
246
279
  def get_documentation(self, module_name):
247
280
  """
248
281
  Call endpoint to get documentation for specified application
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env python
2
2
  # -*- coding: utf-8 -*-
3
3
 
4
- VERSION = "1.44.2"
4
+ VERSION = "1.44.3"
@@ -130,8 +130,13 @@ class ActionsExecutor(Thread):
130
130
 
131
131
  Scripts-only edits set neither frontend nor backend: files are synced
132
132
  and Cleep is left running (install scripts are not re-run on watch).
133
+
134
+ The first change of a batch notifies the UI immediately so the wait
135
+ for the quiet period is visible.
133
136
  """
137
+ notify_started = False
134
138
  with self._lock:
139
+ notify_started = not self._batch.pending()
135
140
  if module:
136
141
  self._batch.modules.add(module)
137
142
  if core:
@@ -141,26 +146,38 @@ class ActionsExecutor(Thread):
141
146
  if backend:
142
147
  self._batch.backend = True
143
148
  self._batch.last = time.monotonic()
149
+ if notify_started:
150
+ self.cleep.notify_sync_started()
144
151
 
145
152
  def _run_batch(self, batch):
146
153
  failed = False
147
- if batch.core:
148
- self.logger.info("Syncing core")
149
- if not self.file.core_sync():
150
- failed = True
151
- for module in sorted(batch.modules):
152
- self.logger.info('Syncing module "%s"', module)
153
- if not self.file.module_sync(module):
154
- failed = True
155
- if failed:
156
- self.logger.error("Sync failed, Cleep was not restarted")
157
- return
158
- if batch.backend:
159
- # Backend restart drops the UI connection. The page reloads on its own
160
- # once Cleep answers again, with the frontend files already synced.
161
- self.cleep.restart_backend()
162
- elif batch.frontend:
163
- self.cleep.restart_frontend()
154
+ try:
155
+ if batch.core:
156
+ self.logger.info("Syncing core")
157
+ if not self.file.core_sync():
158
+ failed = True
159
+ for module in sorted(batch.modules):
160
+ self.logger.info('Syncing module "%s"', module)
161
+ if not self.file.module_sync(module):
162
+ failed = True
163
+ if failed:
164
+ self.logger.error("Sync failed, Cleep was not restarted")
165
+ self.cleep.notify_sync_failed()
166
+ return
167
+ if batch.backend:
168
+ # Backend restart drops the UI connection. The page reloads on its own
169
+ # once Cleep answers again, with the frontend files already synced.
170
+ if not self.cleep.restart_backend():
171
+ self.cleep.notify_sync_failed()
172
+ elif batch.frontend:
173
+ if not self.cleep.restart_frontend():
174
+ self.cleep.notify_sync_failed()
175
+ else:
176
+ # Scripts-only: files synced, Cleep keeps running
177
+ self.cleep.notify_sync_done()
178
+ except Exception:
179
+ self.cleep.notify_sync_failed()
180
+ raise
164
181
 
165
182
  def run(self):
166
183
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cleepcli
3
- Version: 1.44.2
3
+ Version: 1.44.3
4
4
  Summary: Cleep-cli helps developers to build great Cleep applications from command line.
5
5
  Home-page: https://github.com/CleepDevice/cleep-cli
6
6
  Author: Tanguy Bonneau
@@ -201,8 +201,10 @@ class QuietPeriodTests(unittest.TestCase):
201
201
  self.assertTrue(self._wait_until(lambda: executor.file.core_sync.call_count >= 1))
202
202
  time.sleep(0.4)
203
203
  self.assertEqual(executor.file.core_sync.call_count, 1)
204
+ executor.cleep.notify_sync_started.assert_called_once()
204
205
  executor.cleep.restart_backend.assert_called_once()
205
206
  executor.cleep.restart_frontend.assert_not_called()
207
+ executor.cleep.notify_sync_done.assert_not_called()
206
208
  finally:
207
209
  executor.stop()
208
210
  executor.join(timeout=2)
@@ -217,6 +219,7 @@ class QuietPeriodTests(unittest.TestCase):
217
219
  time.sleep(0.4)
218
220
  executor.cleep.restart_backend.assert_not_called()
219
221
  executor.cleep.restart_frontend.assert_not_called()
222
+ executor.cleep.notify_sync_failed.assert_called_once()
220
223
  finally:
221
224
  executor.stop()
222
225
  executor.join(timeout=2)
@@ -228,6 +231,7 @@ class QuietPeriodTests(unittest.TestCase):
228
231
  executor.note_change(module="audio", frontend=True)
229
232
  self.assertTrue(self._wait_until(lambda: executor.file.module_sync.call_count >= 1))
230
233
  time.sleep(0.4)
234
+ executor.cleep.notify_sync_started.assert_called_once()
231
235
  executor.cleep.restart_backend.assert_not_called()
232
236
  executor.cleep.restart_frontend.assert_called_once()
233
237
  finally:
@@ -243,6 +247,7 @@ class QuietPeriodTests(unittest.TestCase):
243
247
  time.sleep(0.4)
244
248
  executor.cleep.restart_backend.assert_not_called()
245
249
  executor.cleep.restart_frontend.assert_not_called()
250
+ executor.cleep.notify_sync_done.assert_called_once()
246
251
  finally:
247
252
  executor.stop()
248
253
  executor.join(timeout=2)
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
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