fastled 1.2.20__py3-none-any.whl → 1.2.21__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.
- fastled/__init__.py +4 -2
- fastled/open_browser.py +19 -3
- fastled/open_browser2.py +14 -35
- {fastled-1.2.20.dist-info → fastled-1.2.21.dist-info}/METADATA +2 -1
- {fastled-1.2.20.dist-info → fastled-1.2.21.dist-info}/RECORD +9 -9
- {fastled-1.2.20.dist-info → fastled-1.2.21.dist-info}/LICENSE +0 -0
- {fastled-1.2.20.dist-info → fastled-1.2.21.dist-info}/WHEEL +0 -0
- {fastled-1.2.20.dist-info → fastled-1.2.21.dist-info}/entry_points.txt +0 -0
- {fastled-1.2.20.dist-info → fastled-1.2.21.dist-info}/top_level.txt +0 -0
fastled/__init__.py
CHANGED
@@ -15,7 +15,7 @@ from .types import BuildMode, CompileResult, CompileServerError
|
|
15
15
|
# IMPORTANT! There's a bug in github which will REJECT any version update
|
16
16
|
# that has any other change in the repo. Please bump the version as the
|
17
17
|
# ONLY change in a commit, or else the pypi update and the release will fail.
|
18
|
-
__version__ = "1.2.
|
18
|
+
__version__ = "1.2.21"
|
19
19
|
|
20
20
|
|
21
21
|
class Api:
|
@@ -184,7 +184,9 @@ class Docker:
|
|
184
184
|
)
|
185
185
|
else:
|
186
186
|
print(f"Cloning {url} into {output_dir}")
|
187
|
-
subprocess.run(
|
187
|
+
subprocess.run(
|
188
|
+
["git", "clone", "--depth", "1", url, str(output_dir)], check=True
|
189
|
+
)
|
188
190
|
|
189
191
|
dockerfile_path = (
|
190
192
|
output_dir / "src" / "platforms" / "wasm" / "compiler" / "Dockerfile"
|
fastled/open_browser.py
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
+
import socket
|
1
2
|
import subprocess
|
2
3
|
import sys
|
4
|
+
import time
|
5
|
+
import webbrowser
|
3
6
|
from multiprocessing import Process
|
4
7
|
from pathlib import Path
|
5
8
|
|
@@ -21,8 +24,6 @@ def open_http_server_subprocess(
|
|
21
24
|
"--port",
|
22
25
|
str(port),
|
23
26
|
]
|
24
|
-
if not open_browser:
|
25
|
-
cmd.append("--no-browser")
|
26
27
|
# return subprocess.Popen(cmd) # type ignore
|
27
28
|
# pipe stderr and stdout to null
|
28
29
|
subprocess.run(
|
@@ -55,6 +56,16 @@ def find_free_port(start_port: int) -> int:
|
|
55
56
|
raise ValueError("Could not find a free port")
|
56
57
|
|
57
58
|
|
59
|
+
def wait_for_server(port: int, timeout: int = 10) -> None:
|
60
|
+
"""Wait for the server to start."""
|
61
|
+
future_time = time.time() + timeout
|
62
|
+
while future_time > time.time():
|
63
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
64
|
+
if sock.connect_ex(("localhost", port)) == 0:
|
65
|
+
return
|
66
|
+
raise TimeoutError("Could not connect to server")
|
67
|
+
|
68
|
+
|
58
69
|
def open_browser_process(
|
59
70
|
fastled_js: Path, port: int | None = None, open_browser: bool = True
|
60
71
|
) -> Process:
|
@@ -62,13 +73,18 @@ def open_browser_process(
|
|
62
73
|
if port is not None:
|
63
74
|
if not is_port_free(port):
|
64
75
|
raise ValueError(f"Port {port} was specified but in use in use")
|
65
|
-
|
76
|
+
else:
|
77
|
+
port = find_free_port(DEFAULT_PORT)
|
66
78
|
out: Process = Process(
|
67
79
|
target=open_http_server_subprocess,
|
68
80
|
args=(fastled_js, port, open_browser),
|
69
81
|
daemon=True,
|
70
82
|
)
|
71
83
|
out.start()
|
84
|
+
wait_for_server(port)
|
85
|
+
if open_browser:
|
86
|
+
print(f"Opening browser to http://localhost:{port}")
|
87
|
+
webbrowser.open(url=f"http://localhost:{port}", new=1, autoraise=True)
|
72
88
|
return out
|
73
89
|
|
74
90
|
|
fastled/open_browser2.py
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
import argparse
|
2
|
-
import socket
|
3
|
-
import time
|
4
2
|
from pathlib import Path
|
5
|
-
|
3
|
+
|
4
|
+
from livereload import Server
|
6
5
|
|
7
6
|
|
8
7
|
def _run_flask_server(fastled_js: Path, port: int) -> None:
|
@@ -52,7 +51,13 @@ def _run_flask_server(fastled_js: Path, port: int) -> None:
|
|
52
51
|
response.headers["Expires"] = "0"
|
53
52
|
return response
|
54
53
|
|
55
|
-
app.
|
54
|
+
server = Server(app.wsgi_app)
|
55
|
+
# Watch index.html for changes
|
56
|
+
server.watch(str(fastled_js / "index.html"))
|
57
|
+
# server.watch(str(fastled_js / "index.js"))
|
58
|
+
# server.watch(str(fastled_js / "index.css"))
|
59
|
+
# Start the server
|
60
|
+
server.serve(port=port, debug=True)
|
56
61
|
except KeyboardInterrupt:
|
57
62
|
import _thread
|
58
63
|
|
@@ -64,33 +69,13 @@ def _run_flask_server(fastled_js: Path, port: int) -> None:
|
|
64
69
|
_thread.interrupt_main()
|
65
70
|
|
66
71
|
|
67
|
-
def
|
68
|
-
"""Wait for the server to start."""
|
69
|
-
future_time = time.time() + timeout
|
70
|
-
while future_time > time.time():
|
71
|
-
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
72
|
-
if sock.connect_ex(("localhost", port)) == 0:
|
73
|
-
return
|
74
|
-
raise TimeoutError("Could not connect to server")
|
75
|
-
|
76
|
-
|
77
|
-
def wait_for_server_then_launch_browser(port: int) -> None:
|
78
|
-
"""Wait for the server to start, then launch the browser."""
|
79
|
-
wait_for_server(port)
|
80
|
-
import webbrowser
|
81
|
-
|
82
|
-
webbrowser.open(f"http://localhost:{port}")
|
83
|
-
|
84
|
-
|
85
|
-
def run(path: Path, port: int, open_browser: bool) -> None:
|
72
|
+
def run(path: Path, port: int) -> None:
|
86
73
|
"""Run the Flask server."""
|
87
74
|
try:
|
88
|
-
if open_browser:
|
89
|
-
browser_thread = Thread(
|
90
|
-
target=wait_for_server_then_launch_browser, args=(port,), daemon=True
|
91
|
-
)
|
92
|
-
browser_thread.start()
|
93
75
|
_run_flask_server(path, port)
|
76
|
+
import warnings
|
77
|
+
|
78
|
+
warnings.warn("Flask server has stopped")
|
94
79
|
except KeyboardInterrupt:
|
95
80
|
import _thread
|
96
81
|
|
@@ -113,19 +98,13 @@ def parse_args() -> argparse.Namespace:
|
|
113
98
|
required=True,
|
114
99
|
help="Port to run the server on (default: %(default)s)",
|
115
100
|
)
|
116
|
-
parser.add_argument(
|
117
|
-
"--no-browser",
|
118
|
-
action="store_true",
|
119
|
-
help="Do not open the browser",
|
120
|
-
)
|
121
101
|
return parser.parse_args()
|
122
102
|
|
123
103
|
|
124
104
|
def main() -> None:
|
125
105
|
"""Main function."""
|
126
106
|
args = parse_args()
|
127
|
-
|
128
|
-
run(args.fastled_js, args.port, open_browser)
|
107
|
+
run(args.fastled_js, args.port)
|
129
108
|
|
130
109
|
|
131
110
|
if __name__ == "__main__":
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fastled
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.21
|
4
4
|
Summary: FastLED Wasm Compiler
|
5
5
|
Home-page: https://github.com/zackees/fastled-wasm
|
6
6
|
Maintainer: Zachary Vorhies
|
@@ -20,6 +20,7 @@ Requires-Dist: appdirs>=1.4.4
|
|
20
20
|
Requires-Dist: rapidfuzz>=3.10.1
|
21
21
|
Requires-Dist: progress>=1.6
|
22
22
|
Requires-Dist: Flask>=3.0.0
|
23
|
+
Requires-Dist: livereload
|
23
24
|
|
24
25
|
# FastLED Wasm compiler
|
25
26
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
fastled/__init__.py,sha256=
|
1
|
+
fastled/__init__.py,sha256=39mH7Kz90CU5wcyONJUfZzV7xZ98cLidK79mq8rxdls,10796
|
2
2
|
fastled/app.py,sha256=4LQHjN-GMAzhEaIKSFkT5S26Snb1Y9kgVnPK6kqXbrQ,3382
|
3
3
|
fastled/cli.py,sha256=FjVr31ht0UPlAcmX-84NwfAGMQHTkrCe4o744jCAxiw,375
|
4
4
|
fastled/client_server.py,sha256=eORWVyI1PvyowmhLWt3V9aI_AemPSBL9bAkjMBD2kAw,14282
|
@@ -8,8 +8,8 @@ fastled/docker_manager.py,sha256=Nf0x2BpwT1BvSsi63ZkDhQDMhjiWrjFiXxgowtQMrhM,289
|
|
8
8
|
fastled/filewatcher.py,sha256=LwEQJkqADsArZyY499RLAer6JjJyDwaQBcAvT7xmp3c,6708
|
9
9
|
fastled/keyboard.py,sha256=vyYxE98WCXjvMpcUJd0YXPVvt7TzvBmifLYI-K7jtKg,3524
|
10
10
|
fastled/live_client.py,sha256=b9mVJ-8w_zoEDwKIlAEUC5Q1La5W5rR6ct-exOcgJec,2561
|
11
|
-
fastled/open_browser.py,sha256=
|
12
|
-
fastled/open_browser2.py,sha256=
|
11
|
+
fastled/open_browser.py,sha256=RGbgJYB_iVrsqgcEwPtEyrUQY3nGxo-TQY6BUxJwMmI,3178
|
12
|
+
fastled/open_browser2.py,sha256=jUgN81bEYX-sr0zKTVJkwj9tXEVq7aZTxGUP_ShyCbs,3614
|
13
13
|
fastled/parse_args.py,sha256=LD2PpSEhyq3ZqPWa_TJ90Fb-O-yldi7rnen2fWLOPjo,6868
|
14
14
|
fastled/paths.py,sha256=VsPmgu0lNSCFOoEC0BsTYzDygXqy15AHUfN-tTuzDZA,99
|
15
15
|
fastled/project_init.py,sha256=bBt4DwmW5hZkm9ICt9Qk-0Nr_0JQM7icCgH5Iv-bCQs,3984
|
@@ -25,9 +25,9 @@ fastled/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
|
|
25
25
|
fastled/site/build.py,sha256=l4RajIk0bApiAifT1lyLjIZi9lpPtSba4cnwWP5UOKc,14064
|
26
26
|
fastled/test/can_run_local_docker_tests.py,sha256=LEuUbHctRhNNFWcvnz2kEGmjDJeXO4c3kNpizm3yVJs,400
|
27
27
|
fastled/test/examples.py,sha256=6xPwx_k9_XwYTpI1nk4SrYbsJKHJACd30GzD1epGqhY,1597
|
28
|
-
fastled-1.2.
|
29
|
-
fastled-1.2.
|
30
|
-
fastled-1.2.
|
31
|
-
fastled-1.2.
|
32
|
-
fastled-1.2.
|
33
|
-
fastled-1.2.
|
28
|
+
fastled-1.2.21.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
|
29
|
+
fastled-1.2.21.dist-info/METADATA,sha256=8nlQBsbQyvNJPyDYCCmsJPPgBjdWunsFDzS2C-YNr18,20784
|
30
|
+
fastled-1.2.21.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
31
|
+
fastled-1.2.21.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
|
32
|
+
fastled-1.2.21.dist-info/top_level.txt,sha256=Bbv5kpJpZhWNCvDF4K0VcvtBSDMa8B7PTOrZa9CezHY,8
|
33
|
+
fastled-1.2.21.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|