fastled 1.2.19__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 +5 -3
- fastled/compile_server.py +6 -1
- fastled/open_browser.py +42 -3
- fastled/open_browser2.py +17 -35
- {fastled-1.2.19.dist-info → fastled-1.2.21.dist-info}/METADATA +3 -1
- {fastled-1.2.19.dist-info → fastled-1.2.21.dist-info}/RECORD +10 -10
- {fastled-1.2.19.dist-info → fastled-1.2.21.dist-info}/LICENSE +0 -0
- {fastled-1.2.19.dist-info → fastled-1.2.21.dist-info}/WHEEL +0 -0
- {fastled-1.2.19.dist-info → fastled-1.2.21.dist-info}/entry_points.txt +0 -0
- {fastled-1.2.19.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"
|
@@ -317,7 +319,7 @@ class Test:
|
|
317
319
|
@staticmethod
|
318
320
|
def spawn_http_server(
|
319
321
|
directory: Path | str = Path("."),
|
320
|
-
port: int =
|
322
|
+
port: int | None = None,
|
321
323
|
open_browser: bool = True,
|
322
324
|
) -> Process:
|
323
325
|
from fastled.open_browser import open_browser_process
|
fastled/compile_server.py
CHANGED
@@ -81,7 +81,12 @@ class CompileServer:
|
|
81
81
|
return self.impl._start()
|
82
82
|
|
83
83
|
def stop(self) -> None:
|
84
|
-
|
84
|
+
try:
|
85
|
+
return self.impl.stop()
|
86
|
+
except KeyboardInterrupt:
|
87
|
+
import _thread
|
88
|
+
|
89
|
+
_thread.interrupt_main()
|
85
90
|
|
86
91
|
def process_running(self) -> bool:
|
87
92
|
return self.impl.process_running()
|
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(
|
@@ -36,16 +37,54 @@ def open_http_server_subprocess(
|
|
36
37
|
_thread.interrupt_main()
|
37
38
|
|
38
39
|
|
40
|
+
def is_port_free(port: int) -> bool:
|
41
|
+
"""Check if a port is free"""
|
42
|
+
import socket
|
43
|
+
|
44
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
45
|
+
return s.connect_ex(("localhost", port)) != 0
|
46
|
+
|
47
|
+
|
48
|
+
def find_free_port(start_port: int) -> int:
|
49
|
+
"""Find a free port starting at start_port"""
|
50
|
+
for port in range(start_port, start_port + 100):
|
51
|
+
if is_port_free(port):
|
52
|
+
print(f"Found free port: {port}")
|
53
|
+
return port
|
54
|
+
else:
|
55
|
+
print(f"Port {port} is in use, finding next")
|
56
|
+
raise ValueError("Could not find a free port")
|
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
|
+
|
39
69
|
def open_browser_process(
|
40
|
-
fastled_js: Path, port: int =
|
70
|
+
fastled_js: Path, port: int | None = None, open_browser: bool = True
|
41
71
|
) -> Process:
|
42
72
|
"""Start livereload server in the fastled_js directory and return the process"""
|
73
|
+
if port is not None:
|
74
|
+
if not is_port_free(port):
|
75
|
+
raise ValueError(f"Port {port} was specified but in use in use")
|
76
|
+
else:
|
77
|
+
port = find_free_port(DEFAULT_PORT)
|
43
78
|
out: Process = Process(
|
44
79
|
target=open_http_server_subprocess,
|
45
80
|
args=(fastled_js, port, open_browser),
|
46
81
|
daemon=True,
|
47
82
|
)
|
48
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)
|
49
88
|
return out
|
50
89
|
|
51
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:
|
@@ -12,6 +11,9 @@ def _run_flask_server(fastled_js: Path, port: int) -> None:
|
|
12
11
|
|
13
12
|
app = Flask(__name__)
|
14
13
|
|
14
|
+
# Must be a full path or flask will fail to find the file.
|
15
|
+
fastled_js = fastled_js.resolve()
|
16
|
+
|
15
17
|
@app.route("/")
|
16
18
|
def serve_index():
|
17
19
|
return send_from_directory(fastled_js, "index.html")
|
@@ -49,7 +51,13 @@ def _run_flask_server(fastled_js: Path, port: int) -> None:
|
|
49
51
|
response.headers["Expires"] = "0"
|
50
52
|
return response
|
51
53
|
|
52
|
-
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)
|
53
61
|
except KeyboardInterrupt:
|
54
62
|
import _thread
|
55
63
|
|
@@ -61,33 +69,13 @@ def _run_flask_server(fastled_js: Path, port: int) -> None:
|
|
61
69
|
_thread.interrupt_main()
|
62
70
|
|
63
71
|
|
64
|
-
def
|
65
|
-
"""Wait for the server to start."""
|
66
|
-
future_time = time.time() + timeout
|
67
|
-
while future_time > time.time():
|
68
|
-
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
69
|
-
if sock.connect_ex(("localhost", port)) == 0:
|
70
|
-
return
|
71
|
-
raise TimeoutError("Could not connect to server")
|
72
|
-
|
73
|
-
|
74
|
-
def wait_for_server_then_launch_browser(port: int) -> None:
|
75
|
-
"""Wait for the server to start, then launch the browser."""
|
76
|
-
wait_for_server(port)
|
77
|
-
import webbrowser
|
78
|
-
|
79
|
-
webbrowser.open(f"http://localhost:{port}")
|
80
|
-
|
81
|
-
|
82
|
-
def run(path: Path, port: int, open_browser: bool) -> None:
|
72
|
+
def run(path: Path, port: int) -> None:
|
83
73
|
"""Run the Flask server."""
|
84
74
|
try:
|
85
|
-
if open_browser:
|
86
|
-
browser_thread = Thread(
|
87
|
-
target=wait_for_server_then_launch_browser, args=(port,), daemon=True
|
88
|
-
)
|
89
|
-
browser_thread.start()
|
90
75
|
_run_flask_server(path, port)
|
76
|
+
import warnings
|
77
|
+
|
78
|
+
warnings.warn("Flask server has stopped")
|
91
79
|
except KeyboardInterrupt:
|
92
80
|
import _thread
|
93
81
|
|
@@ -110,19 +98,13 @@ def parse_args() -> argparse.Namespace:
|
|
110
98
|
required=True,
|
111
99
|
help="Port to run the server on (default: %(default)s)",
|
112
100
|
)
|
113
|
-
parser.add_argument(
|
114
|
-
"--no-browser",
|
115
|
-
action="store_true",
|
116
|
-
help="Do not open the browser",
|
117
|
-
)
|
118
101
|
return parser.parse_args()
|
119
102
|
|
120
103
|
|
121
104
|
def main() -> None:
|
122
105
|
"""Main function."""
|
123
106
|
args = parse_args()
|
124
|
-
|
125
|
-
run(args.fastled_js, args.port, open_browser)
|
107
|
+
run(args.fastled_js, args.port)
|
126
108
|
|
127
109
|
|
128
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
|
|
@@ -285,6 +286,7 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` bun
|
|
285
286
|
|
286
287
|
# Revisions
|
287
288
|
|
289
|
+
* 1.2.20 - Fixed up path issue for web browser launch for hot reload.
|
288
290
|
* 1.2.19 - Compilation failure now overwrites the index.html file with error message.
|
289
291
|
* 1.2.16 - Force mime types in web browser as some users may not have it correct in their registry.
|
290
292
|
* 1.2.15 - Rewrote http server using flask. Reduced install size significantly.
|
@@ -1,15 +1,15 @@
|
|
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
|
5
|
-
fastled/compile_server.py,sha256=
|
5
|
+
fastled/compile_server.py,sha256=g0y9vEZqpzAJEUwketV8lbwI8VZNSSLuOuwcF04k-dw,2775
|
6
6
|
fastled/compile_server_impl.py,sha256=B_7zjdKHxX2JbNcx26hntwtk8-MyQTs6LMZlpOEuloM,8746
|
7
7
|
fastled/docker_manager.py,sha256=Nf0x2BpwT1BvSsi63ZkDhQDMhjiWrjFiXxgowtQMrhM,28955
|
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
|