fastled 1.3.16__tar.gz → 1.3.18__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.3.16 → fastled-1.3.18}/PKG-INFO +2 -1
- {fastled-1.3.16 → fastled-1.3.18}/README.md +1 -0
- {fastled-1.3.16 → fastled-1.3.18}/RELEASE.md +2 -0
- {fastled-1.3.16 → fastled-1.3.18}/requirements.testing.txt +1 -1
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/__version__.py +1 -1
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/docker_manager.py +2 -2
- fastled-1.3.18/src/fastled/print_filter.py +52 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/server_flask.py +6 -1
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/types.py +2 -2
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/util.py +6 -3
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled.egg-info/PKG-INFO +2 -1
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled.egg-info/SOURCES.txt +1 -2
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_bad_ino.py +9 -9
- fastled-1.3.18/tests/unit/test_banner_string.py +24 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_debug_fetch_source_files.py +2 -5
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_ino/bad/bad.ino +3 -1
- fastled-1.3.16/src/fastled/print_filter.py +0 -247
- fastled-1.3.16/tests/unit/test_experimental_cpp_filter.py +0 -213
- fastled-1.3.16/tests/unit/test_print_filter.py +0 -28
- {fastled-1.3.16 → fastled-1.3.18}/.aiderignore +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/.dockerignore +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/.github/workflows/build_multi_docker_image.yml +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/.github/workflows/build_webpage.yml +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/.github/workflows/lint.yml +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/.github/workflows/publish_release.yml +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/.github/workflows/template_build_docker_image.yml +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/.github/workflows/test_build_exe.yml +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/.github/workflows/test_macos.yml +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/.github/workflows/test_ubuntu.yml +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/.github/workflows/test_win.yml +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/.gitignore +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/.pylintrc +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/.vscode/launch.json +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/.vscode/settings.json +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/.vscode/tasks.json +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/DEBUGGER.md +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/Dockerfile +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/FAQ.md +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/LICENSE +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/MANIFEST.in +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/TODO.md +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/build_exe.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/build_local_docker.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/build_site.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/clean +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/compiler/debug.sh +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/compiler/run.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/demo/100dots.html +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/demo/demo_threejs.html +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/demo/micdemo.html +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/demo/mp3upload.html +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/demo/webgl_postprocessing_unreal_bloom.html +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/docker-compose.yml +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/entrypoint.sh +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/install +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/install_linux.sh +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/lint +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/pyproject.toml +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/setup.cfg +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/setup.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/__init__.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/app.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/args.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/assets/example.txt +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/assets/localhost-key.pem +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/assets/localhost.pem +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/cli.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/cli_test.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/cli_test_interactive.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/client_server.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/compile_server.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/compile_server_impl.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/filewatcher.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/keyboard.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/keyz.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/live_client.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/open_browser.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/parse_args.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/paths.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/project_init.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/select_sketch_directory.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/server_start.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/settings.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/site/build.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/site/examples.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/sketch.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/spinner.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/string_diff.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/test/can_run_local_docker_tests.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/test/examples.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/version.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled/web_compile.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled.egg-info/dependency_links.txt +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled.egg-info/entry_points.txt +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled.egg-info/requires.txt +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/src/fastled.egg-info/top_level.txt +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/test +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/integration/test_build_examples.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/integration/test_examples.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/html/index.html +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_api.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_cli.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_compile_server.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_docker_linux_on_windows.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_embedded_data.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_filechanger.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_http_server.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_ino/bad_platformio/bad_platformio.ino +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_ino/bad_platformio/platformio.ini +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_ino/embedded/data/bigdata.dat +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_ino/embedded/wasm.ino +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_ino/wasm/wasm.ino +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_project_init.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_server_and_client_seperatly.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_string_diff.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_version.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/tests/unit/test_webcompile.py +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/upload_package.sh +0 -0
- {fastled-1.3.16 → fastled-1.3.18}/vscode-plugin/readme +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fastled
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.18
|
4
4
|
Summary: FastLED Wasm Compiler
|
5
5
|
Home-page: https://github.com/zackees/fastled-wasm
|
6
6
|
Maintainer: Zachary Vorhies
|
@@ -403,6 +403,7 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` bun
|
|
403
403
|
|
404
404
|
## Performance
|
405
405
|
|
406
|
+
|
406
407
|
```
|
407
408
|
###############################
|
408
409
|
# Build started with command: #
|
@@ -5,4 +5,6 @@ Go to src/fastled/__init__.py and increase the version number.
|
|
5
5
|
Make sure this is the ONLY change in your repo (or the release will fail
|
6
6
|
for unknown reasons) and commit and then push. Github builders will do all the rest.
|
7
7
|
|
8
|
+
|
9
|
+
|
8
10
|
Make sure and watch the jobs to verify that it worked.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# IMPORTANT! There's a bug in github which will REJECT any version update
|
2
2
|
# that has any other change in the repo. Please bump the version as the
|
3
3
|
# ONLY change in a commit, or else the pypi update and the release will fail.
|
4
|
-
__version__ = "1.3.
|
4
|
+
__version__ = "1.3.18"
|
5
5
|
|
6
6
|
__version_url_latest__ = "https://raw.githubusercontent.com/zackees/fastled-wasm/refs/heads/main/src/fastled/__version__.py"
|
@@ -25,7 +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,
|
28
|
+
from fastled.print_filter import PrintFilter, PrintFilterDefault
|
29
29
|
from fastled.spinner import Spinner
|
30
30
|
|
31
31
|
CONFIG_DIR = Path(user_data_dir("fastled", "fastled"))
|
@@ -138,7 +138,7 @@ class Volume:
|
|
138
138
|
# Override the default PrintFilter to use a custom one.
|
139
139
|
def make_default_print_filter() -> PrintFilter:
|
140
140
|
"""Create a default PrintFilter instance."""
|
141
|
-
return
|
141
|
+
return PrintFilterDefault()
|
142
142
|
|
143
143
|
|
144
144
|
class RunningContainer:
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import re
|
2
|
+
from abc import ABC, abstractmethod
|
3
|
+
from enum import Enum
|
4
|
+
|
5
|
+
|
6
|
+
class PrintFilter(ABC):
|
7
|
+
"""Abstract base class for filtering text output."""
|
8
|
+
|
9
|
+
def __init__(self, echo: bool = True) -> None:
|
10
|
+
self.echo = echo
|
11
|
+
|
12
|
+
@abstractmethod
|
13
|
+
def filter(self, text: str) -> str:
|
14
|
+
"""Filter the text according to implementation-specific rules."""
|
15
|
+
pass
|
16
|
+
|
17
|
+
def print(self, text: str | bytes) -> str:
|
18
|
+
"""Prints the text to the console after filtering."""
|
19
|
+
if isinstance(text, bytes):
|
20
|
+
text = text.decode("utf-8")
|
21
|
+
text = self.filter(text)
|
22
|
+
if self.echo:
|
23
|
+
print(text, end="")
|
24
|
+
return text
|
25
|
+
|
26
|
+
|
27
|
+
def _handle_ino_cpp(line: str) -> str:
|
28
|
+
if ".ino.cpp" in line[0:30]:
|
29
|
+
# Extract the filename without path and extension
|
30
|
+
match = re.search(r"src/([^/]+)\.ino\.cpp", line)
|
31
|
+
if match:
|
32
|
+
filename = match.group(1)
|
33
|
+
# Replace with examples/Filename/Filename.ino format
|
34
|
+
line = line.replace(
|
35
|
+
f"src/{filename}.ino.cpp", f"examples/{filename}/{filename}.ino"
|
36
|
+
)
|
37
|
+
else:
|
38
|
+
# Fall back to simple extension replacement if regex doesn't match
|
39
|
+
line = line.replace(".ino.cpp", ".ino")
|
40
|
+
return line
|
41
|
+
|
42
|
+
|
43
|
+
class PrintFilterDefault(PrintFilter):
|
44
|
+
"""Provides default filtering for FastLED output."""
|
45
|
+
|
46
|
+
def filter(self, text: str) -> str:
|
47
|
+
return text
|
48
|
+
|
49
|
+
|
50
|
+
class CompileOrLink(Enum):
|
51
|
+
COMPILE = "compile"
|
52
|
+
LINK = "link"
|
@@ -28,11 +28,15 @@ else:
|
|
28
28
|
|
29
29
|
def _is_dwarf_source(path: str) -> bool:
|
30
30
|
"""Check if the path is a dwarf source file."""
|
31
|
+
if "dwarfsource" in path:
|
32
|
+
logger.debug(f"Path '{path}' contains 'dwarfsource'")
|
33
|
+
return True
|
31
34
|
# Check if the path starts with "fastledsource/" or "sketchsource/"
|
32
35
|
return (
|
33
36
|
path.startswith("fastledsource/")
|
34
37
|
or path.startswith("sketchsource/")
|
35
|
-
or path.startswith("dwarfsource")
|
38
|
+
or path.startswith("/dwarfsource/")
|
39
|
+
or path.startswith("dwarfsource/")
|
36
40
|
)
|
37
41
|
|
38
42
|
|
@@ -335,6 +339,7 @@ def _run_flask_server(
|
|
335
339
|
|
336
340
|
try:
|
337
341
|
is_debug_src_code_request = _is_dwarf_source(path)
|
342
|
+
logger.info(f"is debug_src_code_request: {is_debug_src_code_request}")
|
338
343
|
if is_debug_src_code_request:
|
339
344
|
logger.info(f"Handling as drawfsource: {path}")
|
340
345
|
return handle_fastledsource(path)
|
@@ -3,7 +3,7 @@ from enum import Enum
|
|
3
3
|
from typing import Any
|
4
4
|
|
5
5
|
from fastled.args import Args
|
6
|
-
from fastled.print_filter import
|
6
|
+
from fastled.print_filter import PrintFilterDefault
|
7
7
|
|
8
8
|
|
9
9
|
@dataclass
|
@@ -21,7 +21,7 @@ class CompileResult:
|
|
21
21
|
|
22
22
|
def __post_init__(self):
|
23
23
|
# Filter the stdout.
|
24
|
-
pf =
|
24
|
+
pf = PrintFilterDefault(echo=False)
|
25
25
|
self.stdout = pf.print(self.stdout)
|
26
26
|
|
27
27
|
|
@@ -14,9 +14,12 @@ def banner_string(msg: str) -> str:
|
|
14
14
|
lines = msg.splitlines()
|
15
15
|
max_length = max(len(line) for line in lines)
|
16
16
|
border = "#" * (max_length + 4)
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
out: list[str] = []
|
18
|
+
out.append(border)
|
19
|
+
for line in lines:
|
20
|
+
out.append(f"# {line} " + " " * (max_length - len(line)) + "#")
|
21
|
+
out.append(border)
|
22
|
+
return "\n".join(out)
|
20
23
|
|
21
24
|
|
22
25
|
def print_banner(msg: str) -> None:
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fastled
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.18
|
4
4
|
Summary: FastLED Wasm Compiler
|
5
5
|
Home-page: https://github.com/zackees/fastled-wasm
|
6
6
|
Maintainer: Zachary Vorhies
|
@@ -403,6 +403,7 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` bun
|
|
403
403
|
|
404
404
|
## Performance
|
405
405
|
|
406
|
+
|
406
407
|
```
|
407
408
|
###############################
|
408
409
|
# Build started with command: #
|
@@ -91,15 +91,14 @@ tests/integration/test_build_examples.py
|
|
91
91
|
tests/integration/test_examples.py
|
92
92
|
tests/unit/test_api.py
|
93
93
|
tests/unit/test_bad_ino.py
|
94
|
+
tests/unit/test_banner_string.py
|
94
95
|
tests/unit/test_cli.py
|
95
96
|
tests/unit/test_compile_server.py
|
96
97
|
tests/unit/test_debug_fetch_source_files.py
|
97
98
|
tests/unit/test_docker_linux_on_windows.py
|
98
99
|
tests/unit/test_embedded_data.py
|
99
|
-
tests/unit/test_experimental_cpp_filter.py
|
100
100
|
tests/unit/test_filechanger.py
|
101
101
|
tests/unit/test_http_server.py
|
102
|
-
tests/unit/test_print_filter.py
|
103
102
|
tests/unit/test_project_init.py
|
104
103
|
tests/unit/test_server_and_client_seperatly.py
|
105
104
|
tests/unit/test_string_diff.py
|
@@ -35,15 +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
|
-
if "bad/bad.ino:" not in result.stdout: # No .cpp extension.
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
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
|
+
# )
|
47
47
|
|
48
48
|
print(f"Zip size: {len(result.zip_bytes)} bytes")
|
49
49
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import unittest
|
2
|
+
|
3
|
+
from fastled.util import banner_string
|
4
|
+
|
5
|
+
_MSG = "Hello, World!\nsecond line"
|
6
|
+
|
7
|
+
_EXPECTED: str = (
|
8
|
+
"#################\n"
|
9
|
+
"# Hello, World! #\n"
|
10
|
+
"# second line #\n"
|
11
|
+
"#################"
|
12
|
+
)
|
13
|
+
|
14
|
+
|
15
|
+
class TestBannerString(unittest.TestCase):
|
16
|
+
def test_banner_string(self):
|
17
|
+
actual = banner_string(_MSG)
|
18
|
+
print(actual)
|
19
|
+
print(_EXPECTED)
|
20
|
+
self.assertEqual(actual, _EXPECTED)
|
21
|
+
|
22
|
+
|
23
|
+
if __name__ == "__main__":
|
24
|
+
unittest.main()
|
@@ -17,14 +17,11 @@ TEST_INO_WASM = HERE / "test_ino" / "wasm"
|
|
17
17
|
# New refactor has broken this test. Good news, we got the sketch to output debug symbols!!!!!!
|
18
18
|
_ENABLED = True
|
19
19
|
|
20
|
-
_DWARF_SRC_EXAMPLE1 = "http://localhost:{http_port}/fastledsource/js/src/fastledsource/git/fastled/src/FastLED.h"
|
21
|
-
|
22
|
-
"http://localhost:{http_port}/sketchsource/js/sketchsource/headers/FastLED.h"
|
23
|
-
)
|
20
|
+
_DWARF_SRC_EXAMPLE1 = "http://localhost:{http_port}/dwarfsource/fastledsource/js/src/fastledsource/git/fastled/src/FastLED.h"
|
21
|
+
|
24
22
|
|
25
23
|
_DWARF_SRC_EXAMPLES = [
|
26
24
|
_DWARF_SRC_EXAMPLE1,
|
27
|
-
_DWARF_SRC_EXAMPLE2,
|
28
25
|
]
|
29
26
|
|
30
27
|
|
@@ -4,7 +4,6 @@
|
|
4
4
|
/// @example NoisePlusPalette.ino
|
5
5
|
|
6
6
|
|
7
|
-
lsfjsdklfjdskfjkasdfjdsfds /// the garbage heare should trigger a build failure.
|
8
7
|
|
9
8
|
// printf
|
10
9
|
#include <stdio.h>
|
@@ -21,6 +20,9 @@ lsfjsdklfjdskfjkasdfjdsfds /// the garbage heare should trigger a build failure.
|
|
21
20
|
|
22
21
|
#include "fl/ui.h"
|
23
22
|
|
23
|
+
|
24
|
+
lsfjsdklfjdskfjkasdfjdsfds; /// the garbage hear should trigger a build failure.
|
25
|
+
|
24
26
|
using namespace fl;
|
25
27
|
|
26
28
|
#define LED_PIN 3
|
@@ -1,247 +0,0 @@
|
|
1
|
-
import re
|
2
|
-
import zlib
|
3
|
-
from abc import ABC, abstractmethod
|
4
|
-
from dataclasses import dataclass
|
5
|
-
from enum import Enum
|
6
|
-
|
7
|
-
|
8
|
-
class PrintFilter(ABC):
|
9
|
-
"""Abstract base class for filtering text output."""
|
10
|
-
|
11
|
-
def __init__(self, echo: bool = True) -> None:
|
12
|
-
self.echo = echo
|
13
|
-
|
14
|
-
@abstractmethod
|
15
|
-
def filter(self, text: str) -> str:
|
16
|
-
"""Filter the text according to implementation-specific rules."""
|
17
|
-
pass
|
18
|
-
|
19
|
-
def print(self, text: str | bytes) -> str:
|
20
|
-
"""Prints the text to the console after filtering."""
|
21
|
-
if isinstance(text, bytes):
|
22
|
-
text = text.decode("utf-8")
|
23
|
-
text = self.filter(text)
|
24
|
-
if self.echo:
|
25
|
-
print(text, end="")
|
26
|
-
return text
|
27
|
-
|
28
|
-
|
29
|
-
def _handle_ino_cpp(line: str) -> str:
|
30
|
-
if ".ino.cpp" in line[0:30]:
|
31
|
-
# Extract the filename without path and extension
|
32
|
-
match = re.search(r"src/([^/]+)\.ino\.cpp", line)
|
33
|
-
if match:
|
34
|
-
filename = match.group(1)
|
35
|
-
# Replace with examples/Filename/Filename.ino format
|
36
|
-
line = line.replace(
|
37
|
-
f"src/{filename}.ino.cpp", f"examples/{filename}/{filename}.ino"
|
38
|
-
)
|
39
|
-
else:
|
40
|
-
# Fall back to simple extension replacement if regex doesn't match
|
41
|
-
line = line.replace(".ino.cpp", ".ino")
|
42
|
-
return line
|
43
|
-
|
44
|
-
|
45
|
-
def _handle_fastled_src(line: str) -> str:
|
46
|
-
return line.replace("fastled/src", "src")
|
47
|
-
|
48
|
-
|
49
|
-
class PrintFilterDefault(PrintFilter):
|
50
|
-
"""Provides default filtering for FastLED output."""
|
51
|
-
|
52
|
-
def filter(self, text: str) -> str:
|
53
|
-
return text
|
54
|
-
|
55
|
-
|
56
|
-
class PrintFilterFastled(PrintFilter):
|
57
|
-
"""Provides filtering for FastLED output so that source files match up with local names."""
|
58
|
-
|
59
|
-
def __init__(self, echo: bool = True) -> None:
|
60
|
-
super().__init__(echo)
|
61
|
-
self.build_started = False
|
62
|
-
# self.compile_link_active = False
|
63
|
-
# self.compile_link_filter:
|
64
|
-
|
65
|
-
def filter(self, text: str) -> str:
|
66
|
-
lines = text.splitlines()
|
67
|
-
out: list[str] = []
|
68
|
-
for line in lines:
|
69
|
-
## DEBUG DO NOT SUBMIT
|
70
|
-
# print(line)
|
71
|
-
if "# WASM is building" in line:
|
72
|
-
self.build_started = True
|
73
|
-
line = _handle_fastled_src(
|
74
|
-
line
|
75
|
-
) # Always convert fastled/src to src for file matchups.
|
76
|
-
if self.build_started or " error: " in line:
|
77
|
-
line = _handle_ino_cpp(line)
|
78
|
-
out.append(line)
|
79
|
-
text = "\n".join(out)
|
80
|
-
return text
|
81
|
-
|
82
|
-
|
83
|
-
class CompileOrLink(Enum):
|
84
|
-
COMPILE = "compile"
|
85
|
-
LINK = "link"
|
86
|
-
|
87
|
-
|
88
|
-
@dataclass
|
89
|
-
class BuildArtifact:
|
90
|
-
timestamp: float
|
91
|
-
input_artifact: str | None
|
92
|
-
output_artifact: str | None
|
93
|
-
build_flags: str
|
94
|
-
compile_or_link: CompileOrLink
|
95
|
-
hash: int
|
96
|
-
|
97
|
-
def flags_pretty(self) -> str:
|
98
|
-
"""
|
99
|
-
Returns the flags in a pretty format.
|
100
|
-
This is used for printing the flags to the console.
|
101
|
-
"""
|
102
|
-
flags = self.build_flags
|
103
|
-
flags = flags.replace(" -I", "\n-I")
|
104
|
-
flags = flags.replace(" -D", "\n-D")
|
105
|
-
flags = flags.replace(" -l", "\n-l")
|
106
|
-
flags = flags.replace(" -L", "\n-L")
|
107
|
-
flags = flags.replace(" -o", "\n-o")
|
108
|
-
flags = flags.replace(" -W", "\n-W")
|
109
|
-
flags = flags.replace(" -f", "\n-f")
|
110
|
-
flags = flags.replace(" -g", "\n-g")
|
111
|
-
|
112
|
-
# break into lines and sort
|
113
|
-
lines = flags.splitlines()
|
114
|
-
first_line = lines[0]
|
115
|
-
lines.pop(0) # remove first line
|
116
|
-
lines = sorted(lines)
|
117
|
-
# remove duplicates
|
118
|
-
lines = list(dict.fromkeys(lines))
|
119
|
-
# remove empty lines
|
120
|
-
lines = [line for line in lines if line.strip() != ""]
|
121
|
-
# remove leading and trailing whitespace
|
122
|
-
lines = [line.strip() for line in lines]
|
123
|
-
lines = sorted(lines)
|
124
|
-
lines = [first_line] + lines # add first line back to the beginning
|
125
|
-
# stringify
|
126
|
-
flags = "\n".join(lines)
|
127
|
-
return flags
|
128
|
-
|
129
|
-
def __str__(self) -> str:
|
130
|
-
return f"{self.brief()} {self.build_flags} {self.compile_or_link} {self.hash}"
|
131
|
-
|
132
|
-
def brief(self) -> str:
|
133
|
-
return f"{self.timestamp:.2f} {self.output_artifact}"
|
134
|
-
|
135
|
-
def begin_flags(self) -> str:
|
136
|
-
"""
|
137
|
-
Returns the flags that are used to begin a build.
|
138
|
-
This is the flags that are used for the first compile or link.
|
139
|
-
"""
|
140
|
-
|
141
|
-
out: str = (
|
142
|
-
"\n################ NEW COMPILE/LINK FLAG GROUP #####################\n\n"
|
143
|
-
)
|
144
|
-
out += f"{self.flags_pretty()}\n"
|
145
|
-
return out
|
146
|
-
|
147
|
-
def end_flags(self) -> str:
|
148
|
-
"""
|
149
|
-
Returns the flags that are used to end a build.
|
150
|
-
This is the flags that are used for the last compile or link.
|
151
|
-
"""
|
152
|
-
out: str = (
|
153
|
-
"\n################ END COMPILE/LINK FLAG GROUP #####################\n"
|
154
|
-
)
|
155
|
-
return out
|
156
|
-
|
157
|
-
@staticmethod
|
158
|
-
def parse(input_str: str) -> "BuildArtifact | None":
|
159
|
-
"""
|
160
|
-
Parse a single build-log line of the form:
|
161
|
-
"<timestamp> ... <some .cpp or .h file> ... <flags>"
|
162
|
-
|
163
|
-
Returns a BuildArtifact, or None if parsing failed.
|
164
|
-
"""
|
165
|
-
return _parse(input_str)
|
166
|
-
|
167
|
-
|
168
|
-
class TokenFilter(ABC):
|
169
|
-
@abstractmethod
|
170
|
-
def extract(self, tokens: list[str]) -> str | None:
|
171
|
-
"""
|
172
|
-
Scan `tokens`, remove any tokens this filter is responsible for,
|
173
|
-
and return the extracted string (or None if not found/invalid).
|
174
|
-
"""
|
175
|
-
...
|
176
|
-
|
177
|
-
|
178
|
-
class TimestampFilter(TokenFilter):
|
179
|
-
def extract(self, tokens: list[str]) -> str | None:
|
180
|
-
if not tokens:
|
181
|
-
return None
|
182
|
-
candidate = tokens[0]
|
183
|
-
try:
|
184
|
-
_ = float(candidate)
|
185
|
-
return tokens.pop(0)
|
186
|
-
except ValueError:
|
187
|
-
return None
|
188
|
-
|
189
|
-
|
190
|
-
class InputArtifactFilter(TokenFilter):
|
191
|
-
def extract(self, tokens: list[str]) -> str | None:
|
192
|
-
for i, tok in enumerate(tokens):
|
193
|
-
if tok.endswith(".cpp") or tok.endswith(".h"):
|
194
|
-
return tokens.pop(i)
|
195
|
-
return None
|
196
|
-
|
197
|
-
|
198
|
-
class OutputArtifactFilter(TokenFilter):
|
199
|
-
def extract(self, tokens: list[str]) -> str | None:
|
200
|
-
for i, tok in enumerate(tokens):
|
201
|
-
if tok == "-o" and i + 1 < len(tokens):
|
202
|
-
tokens.pop(i) # drop '-o'
|
203
|
-
return tokens.pop(i) # drop & return artifact
|
204
|
-
return None
|
205
|
-
|
206
|
-
|
207
|
-
class ActionFilter(TokenFilter):
|
208
|
-
def extract(self, tokens: list[str]) -> str | None:
|
209
|
-
if "-c" in tokens:
|
210
|
-
return CompileOrLink.COMPILE.value
|
211
|
-
return CompileOrLink.LINK.value
|
212
|
-
|
213
|
-
|
214
|
-
def _parse(line: str) -> BuildArtifact | None:
|
215
|
-
tokens = line.strip().split()
|
216
|
-
if not tokens:
|
217
|
-
return None
|
218
|
-
|
219
|
-
# instantiate in the order we need them
|
220
|
-
filters: list[TokenFilter] = [
|
221
|
-
TimestampFilter(),
|
222
|
-
InputArtifactFilter(),
|
223
|
-
OutputArtifactFilter(),
|
224
|
-
ActionFilter(),
|
225
|
-
]
|
226
|
-
|
227
|
-
# apply each filter
|
228
|
-
raw_ts = filters[0].extract(tokens)
|
229
|
-
raw_in = filters[1].extract(tokens)
|
230
|
-
raw_out = filters[2].extract(tokens)
|
231
|
-
raw_act = filters[3].extract(tokens)
|
232
|
-
|
233
|
-
if raw_ts is None or raw_in is None or raw_act is None:
|
234
|
-
return None
|
235
|
-
|
236
|
-
# the rest of `tokens` are the flags
|
237
|
-
flags_str = " ".join(tokens)
|
238
|
-
h = zlib.adler32(flags_str.encode("utf-8"))
|
239
|
-
|
240
|
-
return BuildArtifact(
|
241
|
-
timestamp=float(raw_ts),
|
242
|
-
input_artifact=raw_in,
|
243
|
-
output_artifact=raw_out,
|
244
|
-
build_flags=flags_str,
|
245
|
-
compile_or_link=CompileOrLink(raw_act),
|
246
|
-
hash=h,
|
247
|
-
)
|