fastled 1.2.74__tar.gz → 1.2.76__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.74 → fastled-1.2.76}/PKG-INFO +1 -1
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/__init__.py +1 -1
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/docker_manager.py +6 -20
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/parse_args.py +30 -2
- fastled-1.2.76/src/fastled/print_filter.py +68 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/select_sketch_directory.py +3 -1
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/types.py +7 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/web_compile.py +38 -2
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled.egg-info/PKG-INFO +1 -1
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled.egg-info/SOURCES.txt +2 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/unit/test_bad_ino.py +9 -1
- fastled-1.2.76/tests/unit/test_print_filter.py +28 -0
- {fastled-1.2.74 → fastled-1.2.76}/.aiderignore +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/.dockerignore +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/.github/workflows/build_multi_docker_image.yml +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/.github/workflows/build_webpage.yml +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/.github/workflows/lint.yml +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/.github/workflows/publish_release.yml +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/.github/workflows/template_build_docker_image.yml +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/.github/workflows/test_build_exe.yml +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/.github/workflows/test_macos.yml +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/.github/workflows/test_ubuntu.yml +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/.github/workflows/test_win.yml +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/.gitignore +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/.pylintrc +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/.vscode/launch.json +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/.vscode/settings.json +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/.vscode/tasks.json +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/Dockerfile +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/LICENSE +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/MANIFEST.in +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/README.md +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/RELEASE.md +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/TODO.md +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/build_exe.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/build_site.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/clean +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/CMakeLists.txt +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/__init__.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/arduino-pre-process.sh +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/build.sh +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/build_archive.sh +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/build_fast.sh +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/code_sync.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/compile.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/compile_lock.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/entrypoint.sh +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/extra/100dots.html +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/extra/demo_threejs.html +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/extra/micdemo.html +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/extra/mp3upload.html +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/extra/webgl_postprocessing_unreal_bloom.html +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/final_prewarm.sh +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/init_runtime.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/install-arduino-cli.sh +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/libcompile/CMakeLists.txt +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/paths.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/pre-process.sh +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/prewarm.sh +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/process-ino.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/process_extended.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/pyproject.toml +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/run.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/server.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/sketch_hasher.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/compiler/wasm_compiler_flags.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/docker-compose.yml +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/install +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/install_linux.sh +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/lint +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/pyproject.toml +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/requirements.testing.txt +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/setup.cfg +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/setup.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/app.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/assets/example.txt +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/assets/localhost-key.pem +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/assets/localhost.pem +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/cli.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/cli_test.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/client_server.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/compile_server.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/compile_server_impl.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/filewatcher.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/interactive_srcs.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/keyboard.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/keyz.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/live_client.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/open_browser.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/paths.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/project_init.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/server_fastapi.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/server_fastapi_cli.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/server_flask.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/server_start.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/settings.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/site/build.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/site/examples.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/sketch.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/spinner.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/string_diff.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/test/can_run_local_docker_tests.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/test/examples.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled/util.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled.egg-info/dependency_links.txt +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled.egg-info/entry_points.txt +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled.egg-info/requires.txt +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/src/fastled.egg-info/top_level.txt +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/test +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/integration/test_build_examples.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/integration/test_examples.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/unit/html/index.html +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/unit/test_api.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/unit/test_cli.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/unit/test_compile_server.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/unit/test_docker_linux_on_windows.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/unit/test_embedded_data.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/unit/test_filechanger.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/unit/test_http_server.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/unit/test_ino/bad/bad.ino +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/unit/test_ino/bad_platformio/bad_platformio.ino +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/unit/test_ino/bad_platformio/platformio.ini +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/unit/test_ino/embedded/data/bigdata.dat +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/unit/test_ino/embedded/wasm.ino +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/unit/test_ino/wasm/wasm.ino +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/unit/test_project_init.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/unit/test_server_and_client_seperatly.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/unit/test_string_diff.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/tests/unit/test_webcompile.py +0 -0
- {fastled-1.2.74 → fastled-1.2.76}/upload_package.sh +0 -0
@@ -13,7 +13,7 @@ from .types import BuildMode, CompileResult, CompileServerError
|
|
13
13
|
# IMPORTANT! There's a bug in github which will REJECT any version update
|
14
14
|
# that has any other change in the repo. Please bump the version as the
|
15
15
|
# ONLY change in a commit, or else the pypi update and the release will fail.
|
16
|
-
__version__ = "1.2.
|
16
|
+
__version__ = "1.2.76"
|
17
17
|
|
18
18
|
DOCKER_FILE = (
|
19
19
|
"https://raw.githubusercontent.com/zackees/fastled-wasm/refs/heads/main/Dockerfile"
|
@@ -25,6 +25,7 @@ from docker.models.containers import Container
|
|
25
25
|
from docker.models.images import Image
|
26
26
|
from filelock import FileLock
|
27
27
|
|
28
|
+
from fastled.print_filter import PrintFilter, PrintFilterFastled
|
28
29
|
from fastled.spinner import Spinner
|
29
30
|
|
30
31
|
CONFIG_DIR = Path(user_data_dir("fastled", "fastled"))
|
@@ -99,25 +100,10 @@ class Volume:
|
|
99
100
|
return volumes
|
100
101
|
|
101
102
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
pass
|
107
|
-
|
108
|
-
def _remove_ino_cpp(self, text: str) -> str:
|
109
|
-
return text.replace(".ino.cpp", ".ino")
|
110
|
-
|
111
|
-
def _filter_all(self, text: str) -> str:
|
112
|
-
text = self._remove_ino_cpp(text)
|
113
|
-
return text
|
114
|
-
|
115
|
-
def print(self, text: str | bytes) -> None:
|
116
|
-
"""Prints the text to the console."""
|
117
|
-
if isinstance(text, bytes):
|
118
|
-
text = text.decode("utf-8")
|
119
|
-
text = self._filter_all(text)
|
120
|
-
print(text, end="")
|
103
|
+
# Override the default PrintFilter to use a custom one.
|
104
|
+
def make_default_print_filter() -> PrintFilter:
|
105
|
+
"""Create a default PrintFilter instance."""
|
106
|
+
return PrintFilterFastled()
|
121
107
|
|
122
108
|
|
123
109
|
class RunningContainer:
|
@@ -127,7 +113,7 @@ class RunningContainer:
|
|
127
113
|
first_run: bool = False,
|
128
114
|
filter: PrintFilter | None = None,
|
129
115
|
) -> None:
|
130
|
-
self.filter = filter or
|
116
|
+
self.filter = filter or make_default_print_filter()
|
131
117
|
self.container = container
|
132
118
|
self.first_run = first_run
|
133
119
|
self.running = True
|
@@ -24,10 +24,37 @@ def _find_fastled_repo(start: Path) -> Path | None:
|
|
24
24
|
return None
|
25
25
|
|
26
26
|
|
27
|
+
_DEFAULT_HELP_TEXT = """
|
28
|
+
FastLED WASM Compiler - Useful options:
|
29
|
+
<directory> Directory containing the FastLED sketch to compile
|
30
|
+
--init [example] Initialize one of the top tier WASM examples
|
31
|
+
--web [url] Use web compiler
|
32
|
+
--server Run the compiler server
|
33
|
+
--debug Build with debug symbols for dev-tools debugging
|
34
|
+
--quick Build in quick mode (default)
|
35
|
+
--release Build in optimized release mode
|
36
|
+
--profile Enable profiling the C++ build system
|
37
|
+
--update Update the docker image for the wasm compiler
|
38
|
+
--purge Remove all FastLED containers and images
|
39
|
+
--version Show version information
|
40
|
+
--help Show detailed help
|
41
|
+
Examples:
|
42
|
+
fastled (will auto detect the sketch directory and prompt you)
|
43
|
+
fastled my_sketch
|
44
|
+
fastled my_sketch --web (compiles using the web compiler only)
|
45
|
+
fastled --init Blink (initializes a new sketch directory with the Blink example)
|
46
|
+
fastled --server (runs the compiler server in the current directory)
|
47
|
+
"""
|
48
|
+
|
49
|
+
|
27
50
|
def parse_args() -> Args:
|
28
51
|
"""Parse command-line arguments."""
|
29
52
|
from fastled import __version__
|
30
53
|
|
54
|
+
# Check if no arguments were provided
|
55
|
+
if len(sys.argv) == 1:
|
56
|
+
print(_DEFAULT_HELP_TEXT)
|
57
|
+
|
31
58
|
parser = argparse.ArgumentParser(description=f"FastLED WASM Compiler {__version__}")
|
32
59
|
parser.add_argument("--version", action="version", version=f"{__version__}")
|
33
60
|
parser.add_argument(
|
@@ -66,7 +93,7 @@ def parse_args() -> Args:
|
|
66
93
|
parser.add_argument(
|
67
94
|
"--profile",
|
68
95
|
action="store_true",
|
69
|
-
help="Enable profiling for
|
96
|
+
help="Enable profiling of the C++ build system used for wasm compilation.",
|
70
97
|
)
|
71
98
|
parser.add_argument(
|
72
99
|
"--force-compile",
|
@@ -79,6 +106,7 @@ def parse_args() -> Args:
|
|
79
106
|
help="Disable automatic updates of the wasm compiler image when using docker.",
|
80
107
|
)
|
81
108
|
parser.add_argument(
|
109
|
+
"-u",
|
82
110
|
"--update",
|
83
111
|
"--upgrade",
|
84
112
|
action="store_true",
|
@@ -89,7 +117,7 @@ def parse_args() -> Args:
|
|
89
117
|
"--local",
|
90
118
|
"-l",
|
91
119
|
action="store_true",
|
92
|
-
help="Use localhost for web compilation from an instance of fastled --server, creating it if necessary",
|
120
|
+
help="(Default): Use localhost for web compilation from an instance of fastled --server, creating it if necessary",
|
93
121
|
)
|
94
122
|
parser.add_argument(
|
95
123
|
"--build",
|
@@ -0,0 +1,68 @@
|
|
1
|
+
import re
|
2
|
+
from abc import ABC, abstractmethod
|
3
|
+
|
4
|
+
|
5
|
+
class PrintFilter(ABC):
|
6
|
+
"""Abstract base class for filtering text output."""
|
7
|
+
|
8
|
+
def __init__(self, echo: bool = True) -> None:
|
9
|
+
self.echo = echo
|
10
|
+
|
11
|
+
@abstractmethod
|
12
|
+
def filter(self, text: str) -> str:
|
13
|
+
"""Filter the text according to implementation-specific rules."""
|
14
|
+
pass
|
15
|
+
|
16
|
+
def print(self, text: str | bytes) -> str:
|
17
|
+
"""Prints the text to the console after filtering."""
|
18
|
+
if isinstance(text, bytes):
|
19
|
+
text = text.decode("utf-8")
|
20
|
+
text = self.filter(text)
|
21
|
+
if self.echo:
|
22
|
+
print(text, end="")
|
23
|
+
return text
|
24
|
+
|
25
|
+
|
26
|
+
def _handle_ino_cpp(line: str) -> str:
|
27
|
+
if ".ino.cpp" in line[0:30]:
|
28
|
+
# Extract the filename without path and extension
|
29
|
+
match = re.search(r"src/([^/]+)\.ino\.cpp", line)
|
30
|
+
if match:
|
31
|
+
filename = match.group(1)
|
32
|
+
# Replace with examples/Filename/Filename.ino format
|
33
|
+
line = line.replace(
|
34
|
+
f"src/{filename}.ino.cpp", f"examples/{filename}/{filename}.ino"
|
35
|
+
)
|
36
|
+
else:
|
37
|
+
# Fall back to simple extension replacement if regex doesn't match
|
38
|
+
line = line.replace(".ino.cpp", ".ino")
|
39
|
+
return line
|
40
|
+
|
41
|
+
|
42
|
+
class PrintFilterDefault(PrintFilter):
|
43
|
+
"""Provides default filtering for FastLED output."""
|
44
|
+
|
45
|
+
def filter(self, text: str) -> str:
|
46
|
+
return text
|
47
|
+
|
48
|
+
|
49
|
+
class PrintFilterFastled(PrintFilter):
|
50
|
+
"""Provides filtering for FastLED output so that source files match up with local names."""
|
51
|
+
|
52
|
+
def __init__(self, echo: bool = True) -> None:
|
53
|
+
super().__init__(echo)
|
54
|
+
self.build_started = False
|
55
|
+
|
56
|
+
def filter(self, text: str) -> str:
|
57
|
+
lines = text.splitlines()
|
58
|
+
out: list[str] = []
|
59
|
+
for line in lines:
|
60
|
+
## DEBUG DO NOT SUBMIT
|
61
|
+
# print(line)
|
62
|
+
if "# WASM is building" in line:
|
63
|
+
self.build_started = True
|
64
|
+
if self.build_started or " error: " in line:
|
65
|
+
line = _handle_ino_cpp(line)
|
66
|
+
out.append(line)
|
67
|
+
text = "\n".join(out)
|
68
|
+
return text
|
@@ -20,7 +20,9 @@ def select_sketch_directory(
|
|
20
20
|
print("\nMultiple Directories found, choose one:")
|
21
21
|
for i, sketch_dir in enumerate(sketch_directories):
|
22
22
|
print(f" [{i+1}]: {sketch_dir}")
|
23
|
-
which = input(
|
23
|
+
which = input(
|
24
|
+
"\nPlease specify a sketch directory\nYou can enter a number or type a fuzzy search: "
|
25
|
+
).strip()
|
24
26
|
try:
|
25
27
|
index = int(which) - 1
|
26
28
|
return str(sketch_directories[index])
|
@@ -4,6 +4,8 @@ from enum import Enum
|
|
4
4
|
from pathlib import Path
|
5
5
|
from typing import Any
|
6
6
|
|
7
|
+
from fastled.print_filter import PrintFilterFastled
|
8
|
+
|
7
9
|
|
8
10
|
@dataclass
|
9
11
|
class Args:
|
@@ -102,6 +104,11 @@ class CompileResult:
|
|
102
104
|
def to_dict(self) -> dict[str, Any]:
|
103
105
|
return self.__dict__.copy()
|
104
106
|
|
107
|
+
def __post_init__(self):
|
108
|
+
# Filter the stdout.
|
109
|
+
pf = PrintFilterFastled(echo=False)
|
110
|
+
self.stdout = pf.print(self.stdout)
|
111
|
+
|
105
112
|
|
106
113
|
class CompileServerError(Exception):
|
107
114
|
"""Error class for failing to instantiate CompileServer."""
|
@@ -4,6 +4,7 @@ import json
|
|
4
4
|
import os
|
5
5
|
import shutil
|
6
6
|
import tempfile
|
7
|
+
import time
|
7
8
|
import zipfile
|
8
9
|
from concurrent.futures import Future, ThreadPoolExecutor, as_completed
|
9
10
|
from dataclasses import dataclass
|
@@ -154,6 +155,37 @@ def find_good_connection(
|
|
154
155
|
return None
|
155
156
|
|
156
157
|
|
158
|
+
def _banner(msg: str) -> str:
|
159
|
+
"""
|
160
|
+
Create a banner for the given message.
|
161
|
+
Example:
|
162
|
+
msg = "Hello, World!"
|
163
|
+
print -> "#################"
|
164
|
+
"# Hello, World! #"
|
165
|
+
"#################"
|
166
|
+
"""
|
167
|
+
lines = msg.split("\n")
|
168
|
+
# Find the width of the widest line
|
169
|
+
max_width = max(len(line) for line in lines)
|
170
|
+
width = max_width + 4 # Add 4 for "# " and " #"
|
171
|
+
|
172
|
+
# Create the top border
|
173
|
+
banner = "\n" + "#" * width + "\n"
|
174
|
+
|
175
|
+
# Add each line with proper padding
|
176
|
+
for line in lines:
|
177
|
+
padding = max_width - len(line)
|
178
|
+
banner += f"# {line}{' ' * padding} #\n"
|
179
|
+
|
180
|
+
# Add the bottom border
|
181
|
+
banner += "#" * width + "\n"
|
182
|
+
return banner
|
183
|
+
|
184
|
+
|
185
|
+
def _print_banner(msg: str) -> None:
|
186
|
+
print(_banner(msg))
|
187
|
+
|
188
|
+
|
157
189
|
def web_compile(
|
158
190
|
directory: Path | str,
|
159
191
|
host: str | None = None,
|
@@ -161,11 +193,12 @@ def web_compile(
|
|
161
193
|
build_mode: BuildMode | None = None,
|
162
194
|
profile: bool = False,
|
163
195
|
) -> CompileResult:
|
196
|
+
start_time = time.time()
|
164
197
|
if isinstance(directory, str):
|
165
198
|
directory = Path(directory)
|
166
199
|
host = _sanitize_host(host or DEFAULT_HOST)
|
167
200
|
build_mode = build_mode or BuildMode.QUICK
|
168
|
-
|
201
|
+
_print_banner(f"Compiling on {host}")
|
169
202
|
auth_token = auth_token or _AUTH_TOKEN
|
170
203
|
if not directory.exists():
|
171
204
|
raise FileNotFoundError(f"Directory not found: {directory}")
|
@@ -186,7 +219,7 @@ def web_compile(
|
|
186
219
|
|
187
220
|
connection_result = find_good_connection(urls)
|
188
221
|
if connection_result is None:
|
189
|
-
|
222
|
+
_print_banner("Connection failed to all endpoints")
|
190
223
|
return CompileResult(
|
191
224
|
success=False,
|
192
225
|
stdout="Connection failed",
|
@@ -270,6 +303,9 @@ def web_compile(
|
|
270
303
|
relative_path = file_path.relative_to(extract_path)
|
271
304
|
out_zip.write(file_path, relative_path)
|
272
305
|
|
306
|
+
diff_time = time.time() - start_time
|
307
|
+
msg = f"Compilation success, took {diff_time:.2f} seconds"
|
308
|
+
_print_banner(msg)
|
273
309
|
return CompileResult(
|
274
310
|
success=True,
|
275
311
|
stdout=stdout,
|
@@ -77,6 +77,7 @@ src/fastled/live_client.py
|
|
77
77
|
src/fastled/open_browser.py
|
78
78
|
src/fastled/parse_args.py
|
79
79
|
src/fastled/paths.py
|
80
|
+
src/fastled/print_filter.py
|
80
81
|
src/fastled/project_init.py
|
81
82
|
src/fastled/select_sketch_directory.py
|
82
83
|
src/fastled/server_fastapi.py
|
@@ -113,6 +114,7 @@ tests/unit/test_docker_linux_on_windows.py
|
|
113
114
|
tests/unit/test_embedded_data.py
|
114
115
|
tests/unit/test_filechanger.py
|
115
116
|
tests/unit/test_http_server.py
|
117
|
+
tests/unit/test_print_filter.py
|
116
118
|
tests/unit/test_project_init.py
|
117
119
|
tests/unit/test_server_and_client_seperatly.py
|
118
120
|
tests/unit/test_string_diff.py
|
@@ -35,7 +35,15 @@ class WebCompileTester(unittest.TestCase):
|
|
35
35
|
print("stdout:")
|
36
36
|
print(result.stdout)
|
37
37
|
self.fail("Expected error not found in stdout")
|
38
|
-
|
38
|
+
if "bad/bad.ino:" not in result.stdout: # No .cpp extension.
|
39
|
+
print(
|
40
|
+
"bad.ino.cpp was not transformed to bad.ino without the cpp extension"
|
41
|
+
)
|
42
|
+
print("stdout:")
|
43
|
+
print(result.stdout)
|
44
|
+
self.fail(
|
45
|
+
"bad.ino.cpp was not transformed to bad.ino without the cpp extension"
|
46
|
+
)
|
39
47
|
|
40
48
|
print(f"Zip size: {len(result.zip_bytes)} bytes")
|
41
49
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"""
|
2
|
+
Unit test file.
|
3
|
+
"""
|
4
|
+
|
5
|
+
import unittest
|
6
|
+
|
7
|
+
from fastled.print_filter import PrintFilterFastled
|
8
|
+
|
9
|
+
|
10
|
+
class PrintFitlerTester(unittest.TestCase):
|
11
|
+
"""Main tester class."""
|
12
|
+
|
13
|
+
def test_print_filter(self) -> None:
|
14
|
+
"""Tests that a project can be filtered"""
|
15
|
+
# Test the PrintFilter class
|
16
|
+
pf = PrintFilterFastled(echo=False)
|
17
|
+
pf.print("# WASM is building") # This should trigger the filter.
|
18
|
+
result = pf.print(
|
19
|
+
"5.36 src/XYPath.ino.cpp:4:1: error: unknown type name 'kdsjfsdkfjsd'"
|
20
|
+
) # This should now be transformed.
|
21
|
+
self.assertNotIn(".ino.cpp", result, "Expected .ino.cpp to be filtered out")
|
22
|
+
self.assertIn(
|
23
|
+
"examples/XYPath/XYPath.ino", result, "Expected path to be transformed"
|
24
|
+
)
|
25
|
+
|
26
|
+
|
27
|
+
if __name__ == "__main__":
|
28
|
+
unittest.main()
|
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
|
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
|