fastled 1.2.14__tar.gz → 1.2.15__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.
- {fastled-1.2.14 → fastled-1.2.15}/PKG-INFO +4 -2
- {fastled-1.2.14 → fastled-1.2.15}/README.md +2 -0
- {fastled-1.2.14 → fastled-1.2.15}/pyproject.toml +1 -1
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/__init__.py +5 -4
- fastled-1.2.15/src/fastled/open_browser.py +63 -0
- fastled-1.2.15/src/fastled/open_browser2.py +90 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled.egg-info/PKG-INFO +4 -2
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled.egg-info/SOURCES.txt +1 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled.egg-info/requires.txt +1 -1
- {fastled-1.2.14 → fastled-1.2.15}/tests/test_http_server.py +0 -7
- fastled-1.2.14/src/fastled/open_browser.py +0 -93
- {fastled-1.2.14 → fastled-1.2.15}/.aiderignore +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/.github/workflows/build_multi_docker_image.yml +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/.github/workflows/build_webpage.yml +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/.github/workflows/lint.yml +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/.github/workflows/publish_release.yml +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/.github/workflows/test_build_exe.yml +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/.github/workflows/test_macos.yml +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/.github/workflows/test_ubuntu.yml +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/.github/workflows/test_win.yml +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/.gitignore +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/.pylintrc +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/.vscode/launch.json +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/.vscode/settings.json +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/.vscode/tasks.json +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/LICENSE +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/MANIFEST.in +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/RELEASE.md +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/TODO.md +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/build_exe.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/build_site.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/clean +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/install +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/lint +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/requirements.testing.txt +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/setup.cfg +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/setup.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/app.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/assets/example.txt +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/cli.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/client_server.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/compile_server.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/compile_server_impl.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/docker_manager.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/filewatcher.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/keyboard.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/live_client.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/parse_args.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/paths.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/project_init.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/select_sketch_directory.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/settings.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/site/build.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/sketch.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/spinner.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/string_diff.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/test/can_run_local_docker_tests.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/test/examples.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/types.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/util.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled/web_compile.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled.egg-info/dependency_links.txt +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled.egg-info/entry_points.txt +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/src/fastled.egg-info/top_level.txt +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/test +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/tests/html/index.html +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/tests/test_api.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/tests/test_bad_ino.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/tests/test_build.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/tests/test_build_examples.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/tests/test_cli.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/tests/test_compile_server.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/tests/test_docker_linux_on_windows.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/tests/test_embedded_data.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/tests/test_examples.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/tests/test_filechanger.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/tests/test_ino/bad/bad.ino +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/tests/test_ino/embedded/data/bigdata.dat +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/tests/test_ino/embedded/wasm.ino +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/tests/test_ino/wasm/wasm.ino +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/tests/test_project_init.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/tests/test_server_and_client_seperatly.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/tests/test_webcompile.py +0 -0
- {fastled-1.2.14 → fastled-1.2.15}/upload_package.sh +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fastled
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.15
|
4
4
|
Summary: FastLED Wasm Compiler
|
5
5
|
Home-page: https://github.com/zackees/fastled-wasm
|
6
6
|
Maintainer: Zachary Vorhies
|
@@ -19,7 +19,7 @@ Requires-Dist: disklru>=2.0.1
|
|
19
19
|
Requires-Dist: appdirs>=1.4.4
|
20
20
|
Requires-Dist: rapidfuzz>=3.10.1
|
21
21
|
Requires-Dist: progress>=1.6
|
22
|
-
Requires-Dist:
|
22
|
+
Requires-Dist: Flask>=3.0.0
|
23
23
|
|
24
24
|
# FastLED Wasm compiler
|
25
25
|
|
@@ -282,8 +282,10 @@ A: `delay()` will block `loop()` which blocks the main thread of the browser. Th
|
|
282
282
|
Q: How can I get the compiled size of my FastLED sketch smaller?
|
283
283
|
A: A big chunk of space is being used by unnecessary javascript `emscripten` bundling. The wasm_compiler_settings.py file in the FastLED repo can tweak this.
|
284
284
|
|
285
|
+
|
285
286
|
# Revisions
|
286
287
|
|
288
|
+
* 1.2.15 - Rewrote http server using flask. Reduced install size significantly.
|
287
289
|
* 1.2.13 - More fixes for npm live-server, now uses `static-npm` to launch it.
|
288
290
|
* 1.2.12 - Fixes for python npm for launching live-server
|
289
291
|
* 1.2.10 - `fastled.Test` now allows you to spawn the http webserver on a folder with an index.html in it.
|
@@ -259,8 +259,10 @@ A: `delay()` will block `loop()` which blocks the main thread of the browser. Th
|
|
259
259
|
Q: How can I get the compiled size of my FastLED sketch smaller?
|
260
260
|
A: A big chunk of space is being used by unnecessary javascript `emscripten` bundling. The wasm_compiler_settings.py file in the FastLED repo can tweak this.
|
261
261
|
|
262
|
+
|
262
263
|
# Revisions
|
263
264
|
|
265
|
+
* 1.2.15 - Rewrote http server using flask. Reduced install size significantly.
|
264
266
|
* 1.2.13 - More fixes for npm live-server, now uses `static-npm` to launch it.
|
265
267
|
* 1.2.12 - Fixes for python npm for launching live-server
|
266
268
|
* 1.2.10 - `fastled.Test` now allows you to spawn the http webserver on a folder with an index.html in it.
|
@@ -3,6 +3,7 @@
|
|
3
3
|
# context
|
4
4
|
import subprocess
|
5
5
|
from contextlib import contextmanager
|
6
|
+
from multiprocessing import Process
|
6
7
|
from pathlib import Path
|
7
8
|
from typing import Generator
|
8
9
|
|
@@ -14,7 +15,7 @@ from .types import BuildMode, CompileResult, CompileServerError
|
|
14
15
|
# IMPORTANT! There's a bug in github which will REJECT any version update
|
15
16
|
# that has any other change in the repo. Please bump the version as the
|
16
17
|
# ONLY change in a commit, or else the pypi update and the release will fail.
|
17
|
-
__version__ = "1.2.
|
18
|
+
__version__ = "1.2.15"
|
18
19
|
|
19
20
|
|
20
21
|
class Api:
|
@@ -318,12 +319,12 @@ class Test:
|
|
318
319
|
directory: Path | str = Path("."),
|
319
320
|
port: int = 8000,
|
320
321
|
open_browser: bool = True,
|
321
|
-
) ->
|
322
|
-
from fastled.open_browser import
|
322
|
+
) -> Process:
|
323
|
+
from fastled.open_browser import open_browser_process
|
323
324
|
|
324
325
|
if isinstance(directory, str):
|
325
326
|
directory = Path(directory)
|
326
|
-
proc:
|
327
|
+
proc: Process = open_browser_process(
|
327
328
|
directory, port=port, open_browser=open_browser
|
328
329
|
)
|
329
330
|
return proc
|
@@ -0,0 +1,63 @@
|
|
1
|
+
import subprocess
|
2
|
+
import sys
|
3
|
+
from multiprocessing import Process
|
4
|
+
from pathlib import Path
|
5
|
+
|
6
|
+
DEFAULT_PORT = 8081
|
7
|
+
|
8
|
+
PYTHON_EXE = sys.executable
|
9
|
+
|
10
|
+
|
11
|
+
def open_http_server_subprocess(
|
12
|
+
fastled_js: Path, port: int, open_browser: bool
|
13
|
+
) -> None:
|
14
|
+
"""Start livereload server in the fastled_js directory and return the process"""
|
15
|
+
|
16
|
+
cmd = [
|
17
|
+
PYTHON_EXE,
|
18
|
+
"-m",
|
19
|
+
"fastled.open_browser2",
|
20
|
+
str(fastled_js),
|
21
|
+
"--port",
|
22
|
+
str(port),
|
23
|
+
]
|
24
|
+
if not open_browser:
|
25
|
+
cmd.append("--no-browser")
|
26
|
+
# return subprocess.Popen(cmd) # type ignore
|
27
|
+
subprocess.run(cmd) # type ignore
|
28
|
+
|
29
|
+
|
30
|
+
def open_browser_process(
|
31
|
+
fastled_js: Path, port: int = DEFAULT_PORT, open_browser: bool = True
|
32
|
+
) -> Process:
|
33
|
+
"""Start livereload server in the fastled_js directory and return the process"""
|
34
|
+
out: Process = Process(
|
35
|
+
target=open_http_server_subprocess,
|
36
|
+
args=(fastled_js, port, open_browser),
|
37
|
+
daemon=True,
|
38
|
+
)
|
39
|
+
out.start()
|
40
|
+
return out
|
41
|
+
|
42
|
+
|
43
|
+
if __name__ == "__main__":
|
44
|
+
import argparse
|
45
|
+
|
46
|
+
parser = argparse.ArgumentParser(
|
47
|
+
description="Open a browser to the fastled_js directory"
|
48
|
+
)
|
49
|
+
parser.add_argument(
|
50
|
+
"fastled_js",
|
51
|
+
type=Path,
|
52
|
+
help="Path to the fastled_js directory",
|
53
|
+
)
|
54
|
+
parser.add_argument(
|
55
|
+
"--port",
|
56
|
+
type=int,
|
57
|
+
default=DEFAULT_PORT,
|
58
|
+
help=f"Port to run the server on (default: {DEFAULT_PORT})",
|
59
|
+
)
|
60
|
+
args = parser.parse_args()
|
61
|
+
|
62
|
+
proc = open_browser_process(args.fastled_js, args.port, open_browser=True)
|
63
|
+
proc.join()
|
@@ -0,0 +1,90 @@
|
|
1
|
+
import argparse
|
2
|
+
import socket
|
3
|
+
import time
|
4
|
+
from pathlib import Path
|
5
|
+
from threading import Thread
|
6
|
+
|
7
|
+
|
8
|
+
def _run_flask_server(fastled_js: Path, port: int) -> None:
|
9
|
+
"""Run Flask server with live reload in a subprocess"""
|
10
|
+
try:
|
11
|
+
from flask import Flask, send_from_directory
|
12
|
+
|
13
|
+
app = Flask(__name__)
|
14
|
+
|
15
|
+
@app.route("/")
|
16
|
+
def serve_index():
|
17
|
+
return send_from_directory(fastled_js, "index.html")
|
18
|
+
|
19
|
+
@app.route("/<path:path>")
|
20
|
+
def serve_files(path):
|
21
|
+
return send_from_directory(fastled_js, path)
|
22
|
+
|
23
|
+
app.run(port=port, debug=True)
|
24
|
+
except Exception as e:
|
25
|
+
print(f"Failed to run Flask server: {e}")
|
26
|
+
import _thread
|
27
|
+
|
28
|
+
_thread.interrupt_main()
|
29
|
+
|
30
|
+
|
31
|
+
def wait_for_server(port: int, timeout: int = 10) -> None:
|
32
|
+
"""Wait for the server to start."""
|
33
|
+
future_time = time.time() + timeout
|
34
|
+
while future_time > time.time():
|
35
|
+
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
36
|
+
if sock.connect_ex(("localhost", port)) == 0:
|
37
|
+
return
|
38
|
+
raise TimeoutError("Could not connect to server")
|
39
|
+
|
40
|
+
|
41
|
+
def wait_for_server_then_launch_browser(port: int) -> None:
|
42
|
+
"""Wait for the server to start, then launch the browser."""
|
43
|
+
wait_for_server(port)
|
44
|
+
import webbrowser
|
45
|
+
|
46
|
+
webbrowser.open(f"http://localhost:{port}")
|
47
|
+
|
48
|
+
|
49
|
+
def run(path: Path, port: int, open_browser: bool) -> None:
|
50
|
+
"""Run the Flask server."""
|
51
|
+
if open_browser:
|
52
|
+
browser_thread = Thread(
|
53
|
+
target=wait_for_server_then_launch_browser, args=(port,), daemon=True
|
54
|
+
)
|
55
|
+
browser_thread.start()
|
56
|
+
_run_flask_server(path, port)
|
57
|
+
|
58
|
+
|
59
|
+
def parse_args() -> argparse.Namespace:
|
60
|
+
"""Parse the command line arguments."""
|
61
|
+
parser = argparse.ArgumentParser(
|
62
|
+
description="Open a browser to the fastled_js directory"
|
63
|
+
)
|
64
|
+
parser.add_argument(
|
65
|
+
"fastled_js", type=Path, help="Path to the fastled_js directory"
|
66
|
+
)
|
67
|
+
parser.add_argument(
|
68
|
+
"--port",
|
69
|
+
"-p",
|
70
|
+
type=int,
|
71
|
+
required=True,
|
72
|
+
help="Port to run the server on (default: %(default)s)",
|
73
|
+
)
|
74
|
+
parser.add_argument(
|
75
|
+
"--no-browser",
|
76
|
+
action="store_true",
|
77
|
+
help="Do not open the browser",
|
78
|
+
)
|
79
|
+
return parser.parse_args()
|
80
|
+
|
81
|
+
|
82
|
+
def main() -> None:
|
83
|
+
"""Main function."""
|
84
|
+
args = parse_args()
|
85
|
+
open_browser = not args.no_browser
|
86
|
+
run(args.fastled_js, args.port, open_browser)
|
87
|
+
|
88
|
+
|
89
|
+
if __name__ == "__main__":
|
90
|
+
main()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: fastled
|
3
|
-
Version: 1.2.
|
3
|
+
Version: 1.2.15
|
4
4
|
Summary: FastLED Wasm Compiler
|
5
5
|
Home-page: https://github.com/zackees/fastled-wasm
|
6
6
|
Maintainer: Zachary Vorhies
|
@@ -19,7 +19,7 @@ Requires-Dist: disklru>=2.0.1
|
|
19
19
|
Requires-Dist: appdirs>=1.4.4
|
20
20
|
Requires-Dist: rapidfuzz>=3.10.1
|
21
21
|
Requires-Dist: progress>=1.6
|
22
|
-
Requires-Dist:
|
22
|
+
Requires-Dist: Flask>=3.0.0
|
23
23
|
|
24
24
|
# FastLED Wasm compiler
|
25
25
|
|
@@ -282,8 +282,10 @@ A: `delay()` will block `loop()` which blocks the main thread of the browser. Th
|
|
282
282
|
Q: How can I get the compiled size of my FastLED sketch smaller?
|
283
283
|
A: A big chunk of space is being used by unnecessary javascript `emscripten` bundling. The wasm_compiler_settings.py file in the FastLED repo can tweak this.
|
284
284
|
|
285
|
+
|
285
286
|
# Revisions
|
286
287
|
|
288
|
+
* 1.2.15 - Rewrote http server using flask. Reduced install size significantly.
|
287
289
|
* 1.2.13 - More fixes for npm live-server, now uses `static-npm` to launch it.
|
288
290
|
* 1.2.12 - Fixes for python npm for launching live-server
|
289
291
|
* 1.2.10 - `fastled.Test` now allows you to spawn the http webserver on a folder with an index.html in it.
|
@@ -16,12 +16,6 @@ TIMEOUT = 120
|
|
16
16
|
|
17
17
|
assert INDEX_HTML.exists()
|
18
18
|
|
19
|
-
# def override(url) -> None:
|
20
|
-
# """Override the server url."""
|
21
|
-
# assert isinstance(url, str) and "localhost" in url
|
22
|
-
|
23
|
-
# client_server.TEST_BEFORE_COMPILE = override
|
24
|
-
|
25
19
|
|
26
20
|
class HttpServerTester(unittest.TestCase):
|
27
21
|
"""Main tester class."""
|
@@ -42,7 +36,6 @@ class HttpServerTester(unittest.TestCase):
|
|
42
36
|
response = httpx.get("http://localhost:8081", timeout=5)
|
43
37
|
self.assertEqual(response.status_code, 200)
|
44
38
|
proc.kill()
|
45
|
-
proc.wait()
|
46
39
|
|
47
40
|
|
48
41
|
if __name__ == "__main__":
|
@@ -1,93 +0,0 @@
|
|
1
|
-
import shutil
|
2
|
-
import socket
|
3
|
-
import subprocess
|
4
|
-
from multiprocessing import Process
|
5
|
-
from pathlib import Path
|
6
|
-
|
7
|
-
from static_npm import Npm, Npx
|
8
|
-
from static_npm.paths import CACHE_DIR
|
9
|
-
from static_npm.running_process import RunningProcess
|
10
|
-
|
11
|
-
DEFAULT_PORT = 8081
|
12
|
-
|
13
|
-
|
14
|
-
def open_http_server(
|
15
|
-
fastled_js: Path, port: int | None = None, open_browser=True
|
16
|
-
) -> subprocess.Popen | RunningProcess:
|
17
|
-
"""Start livereload server in the fastled_js directory using API"""
|
18
|
-
cmd_list: list[str]
|
19
|
-
print(f"\nStarting livereload server in {fastled_js}")
|
20
|
-
|
21
|
-
cmd_list = ["live-server"]
|
22
|
-
if port is not None:
|
23
|
-
cmd_list.extend([f"--port={port}"])
|
24
|
-
if not open_browser:
|
25
|
-
cmd_list.append("--no-browser")
|
26
|
-
|
27
|
-
live_server_where = shutil.which("live-server")
|
28
|
-
if live_server_where is None:
|
29
|
-
print("live-server not found. Installing it with the embedded npm...")
|
30
|
-
# cmd_list = [sys.executable, "-m", "nodejs.npm", "install", "-g", "live-server"]
|
31
|
-
# npm.call("install -g live-server --force --legacy-peer-deps")
|
32
|
-
tool_dir = CACHE_DIR / "live-server"
|
33
|
-
tool_dir.mkdir(parents=True, exist_ok=True)
|
34
|
-
npm = Npm()
|
35
|
-
npx = Npx()
|
36
|
-
npm.run(["install", "live-server", "--prefix", tool_dir])
|
37
|
-
# npm.run(["install", "live-server", "--prefix", str(tool_dir)])
|
38
|
-
cmd_str = subprocess.list2cmdline(
|
39
|
-
["npx"] + ["--prefix", str(tool_dir)] + cmd_list
|
40
|
-
)
|
41
|
-
print(f"Running: {cmd_str}")
|
42
|
-
proc = npx.run(["--prefix", str(tool_dir)] + cmd_list, cwd=fastled_js)
|
43
|
-
return proc # type ignore
|
44
|
-
else:
|
45
|
-
# npx.run("live-server", check=False)
|
46
|
-
# subprocess.run(cmd_list)
|
47
|
-
live_server_where = shutil.which("live-server")
|
48
|
-
print(f"Using live-server from {live_server_where}")
|
49
|
-
cmd_list = ["live-server"]
|
50
|
-
if port is not None:
|
51
|
-
cmd_list.extend([f"--port={port}"])
|
52
|
-
if not open_browser:
|
53
|
-
cmd_list.append("--no-browser")
|
54
|
-
# subprocess.run(["cd", str(fastled_js), "&&"] + cmd_list)
|
55
|
-
return subprocess.Popen(cmd_list, cwd=str(fastled_js), shell=True)
|
56
|
-
|
57
|
-
|
58
|
-
def _open_browser_python(fastled_js: Path) -> None:
|
59
|
-
"""Start livereload server in the fastled_js directory using API"""
|
60
|
-
proc = open_http_server(fastled_js)
|
61
|
-
proc.wait()
|
62
|
-
|
63
|
-
|
64
|
-
def _find_open_port(start_port: int) -> int:
|
65
|
-
"""Find an open port starting from start_port."""
|
66
|
-
port = start_port
|
67
|
-
while True:
|
68
|
-
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
|
69
|
-
if sock.connect_ex(("localhost", port)) != 0:
|
70
|
-
return port
|
71
|
-
port += 1
|
72
|
-
|
73
|
-
|
74
|
-
def _run_server(fastled_js: Path) -> None:
|
75
|
-
"""Function to run in separate process that starts the livereload server"""
|
76
|
-
|
77
|
-
try:
|
78
|
-
# Keep the process running
|
79
|
-
_open_browser_python(fastled_js)
|
80
|
-
except KeyboardInterrupt:
|
81
|
-
print("\nShutting down livereload server...")
|
82
|
-
|
83
|
-
|
84
|
-
def open_browser_process(fastled_js: Path) -> Process:
|
85
|
-
"""Start livereload server in the fastled_js directory and return the process"""
|
86
|
-
|
87
|
-
process = Process(
|
88
|
-
target=_run_server,
|
89
|
-
args=(fastled_js,),
|
90
|
-
daemon=True,
|
91
|
-
)
|
92
|
-
process.start()
|
93
|
-
return process
|
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
|
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
|
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
|
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
|