colcon-dashboard 0.3.0__py3-none-any.whl
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.
- colcon_dashboard/__init__.py +3 -0
- colcon_dashboard/__main__.py +3 -0
- colcon_dashboard/event_handler.py +42 -0
- colcon_dashboard/server.py +911 -0
- colcon_dashboard/static/app.js +1967 -0
- colcon_dashboard/static/index.html +125 -0
- colcon_dashboard/static/style.css +537 -0
- colcon_dashboard-0.3.0.dist-info/METADATA +200 -0
- colcon_dashboard-0.3.0.dist-info/RECORD +13 -0
- colcon_dashboard-0.3.0.dist-info/WHEEL +5 -0
- colcon_dashboard-0.3.0.dist-info/entry_points.txt +5 -0
- colcon_dashboard-0.3.0.dist-info/licenses/LICENSE +202 -0
- colcon_dashboard-0.3.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""colcon event handler that spawns the dashboard when a build starts.
|
|
2
|
+
|
|
3
|
+
Loaded by colcon through the `colcon_core.event_handler` entry point. The
|
|
4
|
+
handler is off by default: enable it for one build with
|
|
5
|
+
`--event-handlers dashboard+`, for every build with
|
|
6
|
+
`COLCON_DASHBOARD=1`, or through `~/.colcon/defaults.yaml`. The
|
|
7
|
+
command line toggle always wins over the environment default.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import os
|
|
11
|
+
|
|
12
|
+
from colcon_core.event_handler import EventHandlerExtensionPoint
|
|
13
|
+
from colcon_core.plugin_system import satisfies_version
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class DashboardEventHandler(EventHandlerExtensionPoint):
|
|
17
|
+
"""Serve a live web dashboard for this build."""
|
|
18
|
+
|
|
19
|
+
def __init__(self): # noqa: D107
|
|
20
|
+
super().__init__()
|
|
21
|
+
satisfies_version(
|
|
22
|
+
EventHandlerExtensionPoint.EXTENSION_POINT_VERSION, "^1.0")
|
|
23
|
+
# off by default: starting a server must be a choice, not a surprise
|
|
24
|
+
self.enabled = os.environ.get(
|
|
25
|
+
"COLCON_DASHBOARD", "").lower() in ("1", "yes", "true", "on")
|
|
26
|
+
self._done = False
|
|
27
|
+
|
|
28
|
+
def __call__(self, event): # noqa: D102
|
|
29
|
+
if self._done:
|
|
30
|
+
return
|
|
31
|
+
self._done = True
|
|
32
|
+
args = getattr(self.context, "args", None)
|
|
33
|
+
if getattr(args, "verb_name", None) != "build":
|
|
34
|
+
return
|
|
35
|
+
try:
|
|
36
|
+
# imported lazily: never let the dashboard break a build
|
|
37
|
+
from colcon_dashboard.server import ensure_running
|
|
38
|
+
url, _started = ensure_running(os.getcwd())
|
|
39
|
+
if url:
|
|
40
|
+
print(f"[colcon-dashboard] dashboard: {url}")
|
|
41
|
+
except Exception: # noqa: BLE001
|
|
42
|
+
pass
|