fastled 1.3.1__tar.gz → 1.3.5__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.1 → fastled-1.3.5}/PKG-INFO +2 -2
- {fastled-1.3.1 → fastled-1.3.5}/compiler/pyproject.toml +1 -1
- {fastled-1.3.1 → fastled-1.3.5}/pyproject.toml +1 -1
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/__init__.py +2 -5
- fastled-1.3.5/src/fastled/__version__.py +6 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/docker_manager.py +51 -1
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/parse_args.py +14 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/print_filter.py +58 -1
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/server_flask.py +25 -11
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/types.py +2 -0
- fastled-1.3.5/src/fastled/version.py +41 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled.egg-info/PKG-INFO +2 -2
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled.egg-info/SOURCES.txt +3 -1
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled.egg-info/requires.txt +1 -1
- fastled-1.3.1/tests/unit/test_fetch_debug_source_files.py → fastled-1.3.5/tests/unit/test_debug_fetch_source_files.py +33 -1
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_experimental_cpp_filter.py +74 -28
- {fastled-1.3.1 → fastled-1.3.5}/.aiderignore +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/.dockerignore +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/.github/workflows/build_multi_docker_image.yml +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/.github/workflows/build_webpage.yml +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/.github/workflows/lint.yml +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/.github/workflows/publish_release.yml +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/.github/workflows/template_build_docker_image.yml +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/.github/workflows/test_build_exe.yml +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/.github/workflows/test_macos.yml +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/.github/workflows/test_ubuntu.yml +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/.github/workflows/test_win.yml +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/.gitignore +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/.pylintrc +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/.vscode/launch.json +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/.vscode/settings.json +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/.vscode/tasks.json +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/Dockerfile +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/LICENSE +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/MANIFEST.in +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/README.md +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/RELEASE.md +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/TODO.md +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/build_exe.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/build_local_docker.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/build_site.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/clean +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/compiler/CMakeLists.txt +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/compiler/arduino-pre-process.sh +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/compiler/debug.sh +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/compiler/entrypoint.sh +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/compiler/final_prewarm.sh +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/compiler/init_runtime.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/compiler/install-arduino-cli.sh +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/compiler/libcompile/CMakeLists.txt +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/compiler/prewarm.sh +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/compiler/process-ino.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/compiler/run.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/demo/100dots.html +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/demo/demo_threejs.html +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/demo/micdemo.html +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/demo/mp3upload.html +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/demo/webgl_postprocessing_unreal_bloom.html +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/docker-compose.yml +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/install +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/install_linux.sh +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/lint +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/requirements.testing.txt +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/setup.cfg +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/setup.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/app.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/assets/example.txt +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/assets/localhost-key.pem +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/assets/localhost.pem +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/cli.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/cli_test.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/cli_test_interactive.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/client_server.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/compile_server.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/compile_server_impl.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/filewatcher.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/keyboard.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/keyz.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/live_client.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/open_browser.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/paths.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/project_init.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/select_sketch_directory.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/server_start.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/settings.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/site/build.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/site/examples.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/sketch.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/spinner.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/string_diff.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/test/can_run_local_docker_tests.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/test/examples.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/util.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled/web_compile.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled.egg-info/dependency_links.txt +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled.egg-info/entry_points.txt +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/src/fastled.egg-info/top_level.txt +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/test +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/integration/test_build_examples.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/integration/test_examples.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/html/index.html +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_api.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_bad_ino.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_cli.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_compile_server.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_docker_linux_on_windows.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_embedded_data.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_filechanger.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_http_server.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_ino/bad/bad.ino +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_ino/bad_platformio/bad_platformio.ino +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_ino/bad_platformio/platformio.ini +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_ino/embedded/data/bigdata.dat +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_ino/embedded/wasm.ino +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_ino/wasm/wasm.ino +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_print_filter.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_project_init.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_server_and_client_seperatly.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_string_diff.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_version.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_version_matches.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/tests/unit/test_webcompile.py +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/upload_package.sh +0 -0
- {fastled-1.3.1 → fastled-1.3.5}/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.5
|
4
4
|
Summary: FastLED Wasm Compiler
|
5
5
|
Home-page: https://github.com/zackees/fastled-wasm
|
6
6
|
Maintainer: Zachary Vorhies
|
@@ -20,7 +20,7 @@ Requires-Dist: progress>=1.6
|
|
20
20
|
Requires-Dist: watchfiles>=1.0.5
|
21
21
|
Requires-Dist: Flask>=3.0.0
|
22
22
|
Requires-Dist: livereload
|
23
|
-
Requires-Dist: fastled-wasm-server>=1.0.
|
23
|
+
Requires-Dist: fastled-wasm-server>=1.0.27
|
24
24
|
Dynamic: home-page
|
25
25
|
Dynamic: license-file
|
26
26
|
Dynamic: maintainer
|
@@ -15,7 +15,7 @@ dependencies = [
|
|
15
15
|
"disklru==2.0.0",
|
16
16
|
"psutil==6.1.1",
|
17
17
|
"wormhole-tx",
|
18
|
-
"fastled-wasm-server>=1.0.
|
18
|
+
"fastled-wasm-server>=1.0.27", # Also versions fastled-wasm-compiler dependency.
|
19
19
|
]
|
20
20
|
|
21
21
|
[tool.setuptools]
|
@@ -24,7 +24,7 @@ dependencies = [
|
|
24
24
|
"Flask>=3.0.0",
|
25
25
|
"livereload",
|
26
26
|
###### WASM SERVER ######
|
27
|
-
"fastled-wasm-server>=1.0.
|
27
|
+
"fastled-wasm-server>=1.0.27", # Enforced by unit test to match project <--> docker.
|
28
28
|
]
|
29
29
|
|
30
30
|
dynamic = ["version"]
|
@@ -5,17 +5,13 @@ from multiprocessing import Process
|
|
5
5
|
from pathlib import Path
|
6
6
|
from typing import Generator
|
7
7
|
|
8
|
+
from .__version__ import __version__
|
8
9
|
from .compile_server import CompileServer
|
9
10
|
from .live_client import LiveClient
|
10
11
|
from .settings import DOCKER_FILE, IMAGE_NAME
|
11
12
|
from .site.build import build
|
12
13
|
from .types import BuildMode, CompileResult, CompileServerError, FileResponse
|
13
14
|
|
14
|
-
# IMPORTANT! There's a bug in github which will REJECT any version update
|
15
|
-
# that has any other change in the repo. Please bump the version as the
|
16
|
-
# ONLY change in a commit, or else the pypi update and the release will fail.
|
17
|
-
__version__ = "1.3.1"
|
18
|
-
|
19
15
|
|
20
16
|
class Api:
|
21
17
|
@staticmethod
|
@@ -224,4 +220,5 @@ __all__ = [
|
|
224
220
|
"BuildMode",
|
225
221
|
"FileResponse",
|
226
222
|
"DOCKER_FILE",
|
223
|
+
"__version__",
|
227
224
|
]
|
@@ -0,0 +1,6 @@
|
|
1
|
+
# IMPORTANT! There's a bug in github which will REJECT any version update
|
2
|
+
# that has any other change in the repo. Please bump the version as the
|
3
|
+
# ONLY change in a commit, or else the pypi update and the release will fail.
|
4
|
+
__version__ = "1.3.5"
|
5
|
+
|
6
|
+
__version_url_latest__ = "https://raw.githubusercontent.com/zackees/fastled-wasm/refs/heads/main/src/fastled/__version__.py"
|
@@ -33,6 +33,7 @@ CONFIG_DIR.mkdir(parents=True, exist_ok=True)
|
|
33
33
|
DB_FILE = CONFIG_DIR / "db.db"
|
34
34
|
DISK_CACHE = DiskLRUCache(str(DB_FILE), 10)
|
35
35
|
_IS_GITHUB = "GITHUB_ACTIONS" in os.environ
|
36
|
+
_DEFAULT_BUILD_DIR = "/js/.pio/build"
|
36
37
|
|
37
38
|
|
38
39
|
# Docker uses datetimes in UTC but without the timezone info. If we pass in a tz
|
@@ -42,6 +43,28 @@ def _utc_now_no_tz() -> datetime:
|
|
42
43
|
return now.replace(tzinfo=None)
|
43
44
|
|
44
45
|
|
46
|
+
def set_ramdisk_size(size: str) -> None:
|
47
|
+
"""Set the tmpfs size for the container."""
|
48
|
+
# This is a hack to set the tmpfs size from the environment variable.
|
49
|
+
# It should be set in the docker-compose.yml file.
|
50
|
+
# If not set, return 25MB.
|
51
|
+
try:
|
52
|
+
os.environ["TMPFS_SIZE"] = str(size)
|
53
|
+
except ValueError:
|
54
|
+
os.environ["TMPFS_SIZE"] = "0" # Defaults to off
|
55
|
+
|
56
|
+
|
57
|
+
def get_ramdisk_size() -> str | None:
|
58
|
+
"""Get the tmpfs size for the container."""
|
59
|
+
# This is a hack to get the tmpfs size from the environment variable.
|
60
|
+
# It should be set in the docker-compose.yml file.
|
61
|
+
# If not set, return 25MB.
|
62
|
+
try:
|
63
|
+
return os.environ.get("TMPFS_SIZE", None)
|
64
|
+
except ValueError:
|
65
|
+
return None # Defaults to off
|
66
|
+
|
67
|
+
|
45
68
|
def _win32_docker_location() -> str | None:
|
46
69
|
home_dir = Path.home()
|
47
70
|
out = [
|
@@ -366,7 +389,7 @@ class DockerManager:
|
|
366
389
|
Returns:
|
367
390
|
A tuple of (has_newer_version, message)
|
368
391
|
has_newer_version: True if a newer version is available, False otherwise
|
369
|
-
message: A message describing the result
|
392
|
+
message: A message describing the result, including the date of the newer version if available
|
370
393
|
"""
|
371
394
|
try:
|
372
395
|
# Get the local image
|
@@ -388,6 +411,24 @@ class DockerManager:
|
|
388
411
|
if remote_image_hash_from_local_image == remote_image_hash:
|
389
412
|
return False, f"Local image {image_name}:{tag} is up to date."
|
390
413
|
else:
|
414
|
+
# Get the creation date of the remote image if possible
|
415
|
+
try:
|
416
|
+
# Try to get detailed image info including creation date
|
417
|
+
remote_image_details = self.client.api.inspect_image(
|
418
|
+
f"{image_name}:{tag}"
|
419
|
+
)
|
420
|
+
if "Created" in remote_image_details:
|
421
|
+
created_date = remote_image_details["Created"].split("T")[
|
422
|
+
0
|
423
|
+
] # Extract just the date part
|
424
|
+
return (
|
425
|
+
True,
|
426
|
+
f"Newer version of {image_name}:{tag} is available (published on {created_date}).",
|
427
|
+
)
|
428
|
+
except Exception:
|
429
|
+
pass
|
430
|
+
|
431
|
+
# Fallback if we couldn't get the date
|
391
432
|
return True, f"Newer version of {image_name}:{tag} is available."
|
392
433
|
|
393
434
|
except ImageNotFound:
|
@@ -576,6 +617,7 @@ class DockerManager:
|
|
576
617
|
ports: dict[int, int] | None = None,
|
577
618
|
remove_previous: bool = False,
|
578
619
|
environment: dict[str, str] | None = None,
|
620
|
+
tmpfs_size: str | None = None, # suffixed like 25mb.
|
579
621
|
) -> Container:
|
580
622
|
"""
|
581
623
|
Run a container from an image. If it already exists with matching config, start it.
|
@@ -586,6 +628,8 @@ class DockerManager:
|
|
586
628
|
ports: Dict mapping host ports to container ports
|
587
629
|
Example: {8080: 80} maps host port 8080 to container port 80
|
588
630
|
"""
|
631
|
+
tmpfs_size = tmpfs_size or get_ramdisk_size()
|
632
|
+
sys_admin = tmpfs_size is not None and tmpfs_size != "0"
|
589
633
|
volumes = _hack_to_fix_mac(volumes)
|
590
634
|
# Convert volumes to the format expected by Docker API
|
591
635
|
volumes_dict = None
|
@@ -652,10 +696,16 @@ class DockerManager:
|
|
652
696
|
print("\n" + "#" * msg_len)
|
653
697
|
print(out_msg)
|
654
698
|
print("#" * msg_len + "\n")
|
699
|
+
|
700
|
+
tmpfs: dict[str, str] | None = None
|
701
|
+
if tmpfs_size:
|
702
|
+
tmpfs = {_DEFAULT_BUILD_DIR: f"size={tmpfs_size}"}
|
655
703
|
container = self.client.containers.run(
|
656
704
|
image=image_name,
|
657
705
|
command=command,
|
658
706
|
name=container_name,
|
707
|
+
tmpfs=tmpfs,
|
708
|
+
cap_add=["SYS_ADMIN"] if sys_admin else None,
|
659
709
|
detach=True,
|
660
710
|
tty=True,
|
661
711
|
volumes=volumes_dict,
|
@@ -78,6 +78,12 @@ def parse_args() -> Args:
|
|
78
78
|
action="store_true",
|
79
79
|
help="Just compile, skip opening the browser and watching for changes.",
|
80
80
|
)
|
81
|
+
parser.add_argument(
|
82
|
+
"--ram-disk-size",
|
83
|
+
type=str,
|
84
|
+
default="0",
|
85
|
+
help="Set the size of the ramdisk for the docker container. Use suffixes like '25mb' or '1gb'.",
|
86
|
+
)
|
81
87
|
parser.add_argument(
|
82
88
|
"--web",
|
83
89
|
"-w",
|
@@ -156,6 +162,14 @@ def parse_args() -> Args:
|
|
156
162
|
|
157
163
|
args = parser.parse_args()
|
158
164
|
|
165
|
+
if args.ram_disk_size != "0":
|
166
|
+
from fastled.docker_manager import set_ramdisk_size
|
167
|
+
from fastled.util import banner_string
|
168
|
+
|
169
|
+
msg = banner_string(f"Setting tmpfs size to {args.ram_disk_size}")
|
170
|
+
print(msg)
|
171
|
+
set_ramdisk_size(args.ram_disk_size)
|
172
|
+
|
159
173
|
if args.purge:
|
160
174
|
from fastled.docker_manager import DockerManager
|
161
175
|
|
@@ -94,8 +94,65 @@ class BuildArtifact:
|
|
94
94
|
compile_or_link: CompileOrLink
|
95
95
|
hash: int
|
96
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
|
+
|
97
129
|
def __str__(self) -> str:
|
98
|
-
return f"{self.
|
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
|
99
156
|
|
100
157
|
@staticmethod
|
101
158
|
def parse(input_str: str) -> "BuildArtifact | None":
|
@@ -26,6 +26,16 @@ else:
|
|
26
26
|
logger.disabled = True
|
27
27
|
|
28
28
|
|
29
|
+
def _is_dwarf_source(path: str) -> bool:
|
30
|
+
"""Check if the path is a dwarf source file."""
|
31
|
+
# Check if the path starts with "fastledsource/" or "sketchsource/"
|
32
|
+
return (
|
33
|
+
path.startswith("fastledsource/")
|
34
|
+
or path.startswith("sketchsource/")
|
35
|
+
or path.startswith("dwarfsource")
|
36
|
+
)
|
37
|
+
|
38
|
+
|
29
39
|
def _run_flask_server(
|
30
40
|
fastled_js: Path,
|
31
41
|
port: int,
|
@@ -137,15 +147,8 @@ def _run_flask_server(
|
|
137
147
|
|
138
148
|
start_time = time.time()
|
139
149
|
logger.info(f"Processing request: {request.method} {request.url}")
|
140
|
-
|
141
|
-
if "../" in path:
|
142
|
-
# Prevent directory traversal attacks
|
143
|
-
error_msg = "Directory traversal attack detected"
|
144
|
-
logger.error(error_msg)
|
145
|
-
return Response(error_msg, status=400)
|
146
|
-
|
147
150
|
# Forward the request to the compile server
|
148
|
-
target_url = f"http://localhost:{compile_server_port}/{path}"
|
151
|
+
target_url = f"http://localhost:{compile_server_port}/dwarfsource/{path}"
|
149
152
|
logger.info(f"Requesting: {target_url}")
|
150
153
|
logger.info(f"Processing dwarfsource request for {path}")
|
151
154
|
|
@@ -314,14 +317,25 @@ def _run_flask_server(
|
|
314
317
|
return Response(f"File not found: {path}", status=404)
|
315
318
|
return Response(f"Error serving file: {str(e)}", status=500)
|
316
319
|
|
320
|
+
@app.route("/fastapi")
|
321
|
+
def server_backend_redirect():
|
322
|
+
"""Redirect to the compile server"""
|
323
|
+
logger.info("Redirecting to compile server")
|
324
|
+
target_url = f"http://localhost:{compile_server_port}/docs"
|
325
|
+
logger.info(f"Redirecting to: {target_url}")
|
326
|
+
return Response(
|
327
|
+
f"Redirecting to compile server: <a href='{target_url}'>{target_url}</a>",
|
328
|
+
status=302,
|
329
|
+
headers={"Location": target_url},
|
330
|
+
)
|
331
|
+
|
317
332
|
@app.route("/<path:path>")
|
318
333
|
def serve_files(path: str):
|
319
334
|
logger.info(f"Received request for path: {path}")
|
320
335
|
|
321
336
|
try:
|
322
|
-
|
323
|
-
|
324
|
-
):
|
337
|
+
is_debug_src_code_request = _is_dwarf_source(path)
|
338
|
+
if is_debug_src_code_request:
|
325
339
|
logger.info(f"Handling as drawfsource: {path}")
|
326
340
|
return handle_fastledsource(path)
|
327
341
|
elif path.startswith("sourcefiles/"):
|
@@ -25,6 +25,7 @@ class Args:
|
|
25
25
|
debug: bool
|
26
26
|
quick: bool
|
27
27
|
release: bool
|
28
|
+
ram_disk_size: str # suffixed liked "25mb" or "1gb"
|
28
29
|
|
29
30
|
@staticmethod
|
30
31
|
def from_namespace(args: argparse.Namespace) -> "Args":
|
@@ -88,6 +89,7 @@ class Args:
|
|
88
89
|
debug=args.debug,
|
89
90
|
quick=args.quick,
|
90
91
|
release=args.release,
|
92
|
+
ram_disk_size=args.ram_disk_size,
|
91
93
|
)
|
92
94
|
|
93
95
|
|
@@ -0,0 +1,41 @@
|
|
1
|
+
from concurrent.futures import Future, ThreadPoolExecutor
|
2
|
+
|
3
|
+
import httpx
|
4
|
+
|
5
|
+
from fastled.__version__ import __version_url_latest__
|
6
|
+
|
7
|
+
|
8
|
+
def _fetch_version() -> str | Exception:
|
9
|
+
"""
|
10
|
+
Helper function to fetch the latest version from the GitHub repository.
|
11
|
+
"""
|
12
|
+
try:
|
13
|
+
response = httpx.get(__version_url_latest__)
|
14
|
+
response.raise_for_status()
|
15
|
+
# Extract the version string from the response text
|
16
|
+
version_line = response.text.split("__version__ = ")[1].split('"')[1]
|
17
|
+
return version_line
|
18
|
+
except Exception as e:
|
19
|
+
return e
|
20
|
+
|
21
|
+
|
22
|
+
def get_latest_version() -> Future[str | Exception]:
|
23
|
+
"""
|
24
|
+
Fetch the latest version from the GitHub repository.
|
25
|
+
Returns a future that will resolve with the version string or an exception.
|
26
|
+
"""
|
27
|
+
executor = ThreadPoolExecutor()
|
28
|
+
return executor.submit(_fetch_version)
|
29
|
+
|
30
|
+
|
31
|
+
def unit_test() -> None:
|
32
|
+
future = get_latest_version()
|
33
|
+
latest_version = future.result() # Wait for the future to complete
|
34
|
+
if isinstance(latest_version, Exception):
|
35
|
+
print(f"Error fetching latest version: {latest_version}")
|
36
|
+
else:
|
37
|
+
print(f"Latest version: {latest_version}")
|
38
|
+
|
39
|
+
|
40
|
+
if __name__ == "__main__":
|
41
|
+
unit_test()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: fastled
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.5
|
4
4
|
Summary: FastLED Wasm Compiler
|
5
5
|
Home-page: https://github.com/zackees/fastled-wasm
|
6
6
|
Maintainer: Zachary Vorhies
|
@@ -20,7 +20,7 @@ Requires-Dist: progress>=1.6
|
|
20
20
|
Requires-Dist: watchfiles>=1.0.5
|
21
21
|
Requires-Dist: Flask>=3.0.0
|
22
22
|
Requires-Dist: livereload
|
23
|
-
Requires-Dist: fastled-wasm-server>=1.0.
|
23
|
+
Requires-Dist: fastled-wasm-server>=1.0.27
|
24
24
|
Dynamic: home-page
|
25
25
|
Dynamic: license-file
|
26
26
|
Dynamic: maintainer
|
@@ -51,6 +51,7 @@ demo/micdemo.html
|
|
51
51
|
demo/mp3upload.html
|
52
52
|
demo/webgl_postprocessing_unreal_bloom.html
|
53
53
|
src/fastled/__init__.py
|
54
|
+
src/fastled/__version__.py
|
54
55
|
src/fastled/app.py
|
55
56
|
src/fastled/cli.py
|
56
57
|
src/fastled/cli_test.py
|
@@ -77,6 +78,7 @@ src/fastled/spinner.py
|
|
77
78
|
src/fastled/string_diff.py
|
78
79
|
src/fastled/types.py
|
79
80
|
src/fastled/util.py
|
81
|
+
src/fastled/version.py
|
80
82
|
src/fastled/web_compile.py
|
81
83
|
src/fastled.egg-info/PKG-INFO
|
82
84
|
src/fastled.egg-info/SOURCES.txt
|
@@ -97,10 +99,10 @@ tests/unit/test_api.py
|
|
97
99
|
tests/unit/test_bad_ino.py
|
98
100
|
tests/unit/test_cli.py
|
99
101
|
tests/unit/test_compile_server.py
|
102
|
+
tests/unit/test_debug_fetch_source_files.py
|
100
103
|
tests/unit/test_docker_linux_on_windows.py
|
101
104
|
tests/unit/test_embedded_data.py
|
102
105
|
tests/unit/test_experimental_cpp_filter.py
|
103
|
-
tests/unit/test_fetch_debug_source_files.py
|
104
106
|
tests/unit/test_filechanger.py
|
105
107
|
tests/unit/test_http_server.py
|
106
108
|
tests/unit/test_print_filter.py
|
@@ -68,7 +68,12 @@ class FetchSourceFileTester(unittest.TestCase):
|
|
68
68
|
)
|
69
69
|
with client:
|
70
70
|
wait_for_server(f"http://localhost:{http_port}", timeout=100)
|
71
|
-
|
71
|
+
backend_host = client.url()
|
72
|
+
|
73
|
+
# This url should proxy back to the server at /dwarfsource/fastledsource/git/fastled/src/FastLED.h
|
74
|
+
url = (
|
75
|
+
f"http://localhost:{http_port}/fastledsource/git/fastled/src/FastLED.h"
|
76
|
+
)
|
72
77
|
|
73
78
|
resp = httpx.get(
|
74
79
|
# This type of request will come from the server during debug mode to
|
@@ -82,6 +87,20 @@ class FetchSourceFileTester(unittest.TestCase):
|
|
82
87
|
if content_length == 0:
|
83
88
|
raise Exception("Content-Length is 0")
|
84
89
|
|
90
|
+
backend_url = (
|
91
|
+
backend_host
|
92
|
+
+ "/dwarfsource"
|
93
|
+
+ "/fastledsource/git/fastled/src/FastLED.h"
|
94
|
+
)
|
95
|
+
resp = httpx.get(
|
96
|
+
backend_url,
|
97
|
+
timeout=100,
|
98
|
+
)
|
99
|
+
if resp.status_code != 200:
|
100
|
+
raise Exception(
|
101
|
+
f"Failed to fetch source file from the backend server: {resp.status_code}"
|
102
|
+
)
|
103
|
+
|
85
104
|
for ds in _DWARF_SRC_EXAMPLES:
|
86
105
|
# now get something similar at static/js/fastled/src/platforms/wasm/js.cpp
|
87
106
|
url = ds.format(http_port=http_port)
|
@@ -90,6 +109,19 @@ class FetchSourceFileTester(unittest.TestCase):
|
|
90
109
|
timeout=100,
|
91
110
|
)
|
92
111
|
self.assertTrue(resp.status_code == 200, resp.status_code)
|
112
|
+
content_length = int(resp.headers["Content-Length"])
|
113
|
+
self.assertTrue(content_length > 0, "Content-Length is 0")
|
114
|
+
backend_url = (
|
115
|
+
backend_host + "/dwarfsource/" + "/".join(url.split("/")[1:])
|
116
|
+
)
|
117
|
+
resp = httpx.get(
|
118
|
+
backend_url,
|
119
|
+
timeout=100,
|
120
|
+
)
|
121
|
+
if resp.status_code != 200:
|
122
|
+
raise Exception(
|
123
|
+
f"Failed to fetch source file '{backend_url}' from the backend server: {resp.status_code}"
|
124
|
+
)
|
93
125
|
|
94
126
|
print("Done")
|
95
127
|
|
@@ -124,43 +124,89 @@ src/third_party/cq_kernel/kiss_fft.c
|
|
124
124
|
"""
|
125
125
|
|
126
126
|
|
127
|
-
class
|
128
|
-
|
127
|
+
class Filter:
|
128
|
+
def __init__(self):
|
129
|
+
self._prev_broken_line: str | None = None
|
130
|
+
self._last_build_artifact: BuildArtifact | None = None
|
131
|
+
|
132
|
+
def filter(self, line: str) -> str | None:
|
133
|
+
if not line:
|
134
|
+
return None
|
135
|
+
maybe_prev_broken_line: str | None = self._prev_broken_line
|
136
|
+
self._prev_broken_line = None
|
137
|
+
# if the line starts with a digit, it's a build artifact
|
138
|
+
ba: BuildArtifact | None = BuildArtifact.parse(line)
|
139
|
+
|
140
|
+
if ba is not None: # Successfully parsed a build artifact.
|
141
|
+
# if we have a build artifact, we need to check if it's the same as the last one
|
142
|
+
if (
|
143
|
+
self._last_build_artifact is not None
|
144
|
+
and ba.hash == self._last_build_artifact.hash
|
145
|
+
):
|
146
|
+
# No change in build settings.
|
147
|
+
out = ba.brief()
|
148
|
+
self._last_build_artifact = ba
|
149
|
+
return out
|
150
|
+
if self._last_build_artifact is None:
|
151
|
+
self._last_build_artifact = ba
|
152
|
+
return ba.begin_flags() + "\n" + ba.brief()
|
153
|
+
# we have a new build artifact, so we need to print out the build settings
|
154
|
+
# and the line
|
155
|
+
out = self._last_build_artifact.end_flags() + "\n\n\n"
|
156
|
+
out += ba.begin_flags()
|
157
|
+
out += "\n" + ba.brief()
|
158
|
+
self._last_build_artifact = ba
|
159
|
+
return out
|
160
|
+
|
161
|
+
# We couldn't parse this line so store it in stead.
|
162
|
+
if maybe_prev_broken_line is None:
|
163
|
+
self._prev_broken_line = line
|
164
|
+
return None
|
165
|
+
# we have a previous line, so we can try to merge them because this typically happens
|
166
|
+
# for line breaks.
|
167
|
+
new_line = maybe_prev_broken_line + line
|
168
|
+
ba = BuildArtifact.parse(new_line)
|
169
|
+
if ba is None:
|
170
|
+
return None
|
171
|
+
# we have a build artifact, so we can use it.
|
172
|
+
|
173
|
+
if self._last_build_artifact and (ba.hash == self._last_build_artifact.hash):
|
174
|
+
# No change in build settings.
|
175
|
+
out = ba.brief()
|
176
|
+
return out
|
177
|
+
out = ""
|
178
|
+
# different build settings so we need to print out the new build settings and then the line
|
179
|
+
if self._last_build_artifact is not None:
|
180
|
+
out += "\n" + self._last_build_artifact.end_flags() + "\n\n"
|
181
|
+
out += ba.begin_flags()
|
182
|
+
out += ba.brief() + "\n"
|
183
|
+
self._last_build_artifact = ba
|
184
|
+
return out
|
129
185
|
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
186
|
+
def end(self) -> str:
|
187
|
+
"""Returns the end of the build artifact."""
|
188
|
+
if self._last_build_artifact is None:
|
189
|
+
return ""
|
190
|
+
# we have a build artifact, so we can use it.
|
191
|
+
out = self._last_build_artifact.end_flags()
|
192
|
+
self._last_build_artifact = None
|
193
|
+
return out
|
134
194
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
# print(f"###Filtered: result was {out}")
|
139
|
-
# print("Done")
|
195
|
+
|
196
|
+
class ExperimentalPrintFitlerCppTester(unittest.TestCase):
|
197
|
+
"""Main tester class."""
|
140
198
|
|
141
199
|
def test_build_artifact_parsing(self) -> None:
|
142
200
|
"""Tests that a project can be filtered"""
|
143
201
|
# Test the PrintFilter class
|
144
202
|
lines = _BUILD_CONFIG_SAMPLE.splitlines()
|
145
203
|
lines = [line.strip() for line in lines if line.strip()]
|
146
|
-
|
204
|
+
filter: Filter = Filter()
|
147
205
|
for line in lines:
|
148
|
-
|
149
|
-
if
|
150
|
-
print(
|
151
|
-
|
152
|
-
|
153
|
-
if last_hash is None or ba.hash != last_hash:
|
154
|
-
# print out the build flags
|
155
|
-
print("Found new build flags:")
|
156
|
-
print(ba.build_flags)
|
157
|
-
# now set the hash to the new value
|
158
|
-
last_hash = ba.hash
|
159
|
-
|
160
|
-
# print the time and build output
|
161
|
-
print(f"{ba.timestamp} {ba.output_artifact}")
|
162
|
-
|
163
|
-
print("Done")
|
206
|
+
str_or_none = filter.filter(line)
|
207
|
+
if str_or_none is not None:
|
208
|
+
print(str_or_none)
|
209
|
+
print(filter.end())
|
164
210
|
|
165
211
|
|
166
212
|
if __name__ == "__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
|