fastled 1.2.76__tar.gz → 1.2.78__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.
Files changed (131) hide show
  1. {fastled-1.2.76 → fastled-1.2.78}/PKG-INFO +1 -1
  2. {fastled-1.2.76 → fastled-1.2.78}/compiler/compile.py +24 -4
  3. {fastled-1.2.76 → fastled-1.2.78}/compiler/init_runtime.py +13 -8
  4. {fastled-1.2.76 → fastled-1.2.78}/pyproject.toml +2 -0
  5. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/__init__.py +3 -6
  6. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/app.py +28 -10
  7. fastled-1.2.78/src/fastled/cli_test_interactive.py +21 -0
  8. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/client_server.py +2 -2
  9. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/compile_server_impl.py +64 -8
  10. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/print_filter.py +7 -0
  11. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/settings.py +4 -0
  12. {fastled-1.2.76 → fastled-1.2.78}/src/fastled.egg-info/PKG-INFO +1 -1
  13. {fastled-1.2.76 → fastled-1.2.78}/src/fastled.egg-info/SOURCES.txt +1 -1
  14. fastled-1.2.76/src/fastled/interactive_srcs.py +0 -5
  15. {fastled-1.2.76 → fastled-1.2.78}/.aiderignore +0 -0
  16. {fastled-1.2.76 → fastled-1.2.78}/.dockerignore +0 -0
  17. {fastled-1.2.76 → fastled-1.2.78}/.github/workflows/build_multi_docker_image.yml +0 -0
  18. {fastled-1.2.76 → fastled-1.2.78}/.github/workflows/build_webpage.yml +0 -0
  19. {fastled-1.2.76 → fastled-1.2.78}/.github/workflows/lint.yml +0 -0
  20. {fastled-1.2.76 → fastled-1.2.78}/.github/workflows/publish_release.yml +0 -0
  21. {fastled-1.2.76 → fastled-1.2.78}/.github/workflows/template_build_docker_image.yml +0 -0
  22. {fastled-1.2.76 → fastled-1.2.78}/.github/workflows/test_build_exe.yml +0 -0
  23. {fastled-1.2.76 → fastled-1.2.78}/.github/workflows/test_macos.yml +0 -0
  24. {fastled-1.2.76 → fastled-1.2.78}/.github/workflows/test_ubuntu.yml +0 -0
  25. {fastled-1.2.76 → fastled-1.2.78}/.github/workflows/test_win.yml +0 -0
  26. {fastled-1.2.76 → fastled-1.2.78}/.gitignore +0 -0
  27. {fastled-1.2.76 → fastled-1.2.78}/.pylintrc +0 -0
  28. {fastled-1.2.76 → fastled-1.2.78}/.vscode/launch.json +0 -0
  29. {fastled-1.2.76 → fastled-1.2.78}/.vscode/settings.json +0 -0
  30. {fastled-1.2.76 → fastled-1.2.78}/.vscode/tasks.json +0 -0
  31. {fastled-1.2.76 → fastled-1.2.78}/Dockerfile +0 -0
  32. {fastled-1.2.76 → fastled-1.2.78}/LICENSE +0 -0
  33. {fastled-1.2.76 → fastled-1.2.78}/MANIFEST.in +0 -0
  34. {fastled-1.2.76 → fastled-1.2.78}/README.md +0 -0
  35. {fastled-1.2.76 → fastled-1.2.78}/RELEASE.md +0 -0
  36. {fastled-1.2.76 → fastled-1.2.78}/TODO.md +0 -0
  37. {fastled-1.2.76 → fastled-1.2.78}/build_exe.py +0 -0
  38. {fastled-1.2.76 → fastled-1.2.78}/build_site.py +0 -0
  39. {fastled-1.2.76 → fastled-1.2.78}/clean +0 -0
  40. {fastled-1.2.76 → fastled-1.2.78}/compiler/CMakeLists.txt +0 -0
  41. {fastled-1.2.76 → fastled-1.2.78}/compiler/__init__.py +0 -0
  42. {fastled-1.2.76 → fastled-1.2.78}/compiler/arduino-pre-process.sh +0 -0
  43. {fastled-1.2.76 → fastled-1.2.78}/compiler/build.sh +0 -0
  44. {fastled-1.2.76 → fastled-1.2.78}/compiler/build_archive.sh +0 -0
  45. {fastled-1.2.76 → fastled-1.2.78}/compiler/build_fast.sh +0 -0
  46. {fastled-1.2.76 → fastled-1.2.78}/compiler/code_sync.py +0 -0
  47. {fastled-1.2.76 → fastled-1.2.78}/compiler/compile_lock.py +0 -0
  48. {fastled-1.2.76 → fastled-1.2.78}/compiler/entrypoint.sh +0 -0
  49. {fastled-1.2.76 → fastled-1.2.78}/compiler/extra/100dots.html +0 -0
  50. {fastled-1.2.76 → fastled-1.2.78}/compiler/extra/demo_threejs.html +0 -0
  51. {fastled-1.2.76 → fastled-1.2.78}/compiler/extra/micdemo.html +0 -0
  52. {fastled-1.2.76 → fastled-1.2.78}/compiler/extra/mp3upload.html +0 -0
  53. {fastled-1.2.76 → fastled-1.2.78}/compiler/extra/webgl_postprocessing_unreal_bloom.html +0 -0
  54. {fastled-1.2.76 → fastled-1.2.78}/compiler/final_prewarm.sh +0 -0
  55. {fastled-1.2.76 → fastled-1.2.78}/compiler/install-arduino-cli.sh +0 -0
  56. {fastled-1.2.76 → fastled-1.2.78}/compiler/libcompile/CMakeLists.txt +0 -0
  57. {fastled-1.2.76 → fastled-1.2.78}/compiler/paths.py +0 -0
  58. {fastled-1.2.76 → fastled-1.2.78}/compiler/pre-process.sh +0 -0
  59. {fastled-1.2.76 → fastled-1.2.78}/compiler/prewarm.sh +0 -0
  60. {fastled-1.2.76 → fastled-1.2.78}/compiler/process-ino.py +0 -0
  61. {fastled-1.2.76 → fastled-1.2.78}/compiler/process_extended.py +0 -0
  62. {fastled-1.2.76 → fastled-1.2.78}/compiler/pyproject.toml +0 -0
  63. {fastled-1.2.76 → fastled-1.2.78}/compiler/run.py +0 -0
  64. {fastled-1.2.76 → fastled-1.2.78}/compiler/server.py +0 -0
  65. {fastled-1.2.76 → fastled-1.2.78}/compiler/sketch_hasher.py +0 -0
  66. {fastled-1.2.76 → fastled-1.2.78}/compiler/wasm_compiler_flags.py +0 -0
  67. {fastled-1.2.76 → fastled-1.2.78}/docker-compose.yml +0 -0
  68. {fastled-1.2.76 → fastled-1.2.78}/install +0 -0
  69. {fastled-1.2.76 → fastled-1.2.78}/install_linux.sh +0 -0
  70. {fastled-1.2.76 → fastled-1.2.78}/lint +0 -0
  71. {fastled-1.2.76 → fastled-1.2.78}/requirements.testing.txt +0 -0
  72. {fastled-1.2.76 → fastled-1.2.78}/setup.cfg +0 -0
  73. {fastled-1.2.76 → fastled-1.2.78}/setup.py +0 -0
  74. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/assets/example.txt +0 -0
  75. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/assets/localhost-key.pem +0 -0
  76. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/assets/localhost.pem +0 -0
  77. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/cli.py +0 -0
  78. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/cli_test.py +0 -0
  79. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/compile_server.py +0 -0
  80. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/docker_manager.py +0 -0
  81. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/filewatcher.py +0 -0
  82. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/keyboard.py +0 -0
  83. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/keyz.py +0 -0
  84. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/live_client.py +0 -0
  85. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/open_browser.py +0 -0
  86. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/parse_args.py +0 -0
  87. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/paths.py +0 -0
  88. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/project_init.py +0 -0
  89. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/select_sketch_directory.py +0 -0
  90. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/server_fastapi.py +0 -0
  91. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/server_fastapi_cli.py +0 -0
  92. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/server_flask.py +0 -0
  93. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/server_start.py +0 -0
  94. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/site/build.py +0 -0
  95. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/site/examples.py +0 -0
  96. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/sketch.py +0 -0
  97. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/spinner.py +0 -0
  98. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/string_diff.py +0 -0
  99. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/test/can_run_local_docker_tests.py +0 -0
  100. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/test/examples.py +0 -0
  101. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/types.py +0 -0
  102. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/util.py +0 -0
  103. {fastled-1.2.76 → fastled-1.2.78}/src/fastled/web_compile.py +0 -0
  104. {fastled-1.2.76 → fastled-1.2.78}/src/fastled.egg-info/dependency_links.txt +0 -0
  105. {fastled-1.2.76 → fastled-1.2.78}/src/fastled.egg-info/entry_points.txt +0 -0
  106. {fastled-1.2.76 → fastled-1.2.78}/src/fastled.egg-info/requires.txt +0 -0
  107. {fastled-1.2.76 → fastled-1.2.78}/src/fastled.egg-info/top_level.txt +0 -0
  108. {fastled-1.2.76 → fastled-1.2.78}/test +0 -0
  109. {fastled-1.2.76 → fastled-1.2.78}/tests/integration/test_build_examples.py +0 -0
  110. {fastled-1.2.76 → fastled-1.2.78}/tests/integration/test_examples.py +0 -0
  111. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/html/index.html +0 -0
  112. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/test_api.py +0 -0
  113. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/test_bad_ino.py +0 -0
  114. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/test_cli.py +0 -0
  115. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/test_compile_server.py +0 -0
  116. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/test_docker_linux_on_windows.py +0 -0
  117. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/test_embedded_data.py +0 -0
  118. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/test_filechanger.py +0 -0
  119. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/test_http_server.py +0 -0
  120. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/test_ino/bad/bad.ino +0 -0
  121. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/test_ino/bad_platformio/bad_platformio.ino +0 -0
  122. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/test_ino/bad_platformio/platformio.ini +0 -0
  123. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/test_ino/embedded/data/bigdata.dat +0 -0
  124. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/test_ino/embedded/wasm.ino +0 -0
  125. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/test_ino/wasm/wasm.ino +0 -0
  126. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/test_print_filter.py +0 -0
  127. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/test_project_init.py +0 -0
  128. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/test_server_and_client_seperatly.py +0 -0
  129. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/test_string_diff.py +0 -0
  130. {fastled-1.2.76 → fastled-1.2.78}/tests/unit/test_webcompile.py +0 -0
  131. {fastled-1.2.76 → fastled-1.2.78}/upload_package.sh +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastled
3
- Version: 1.2.76
3
+ Version: 1.2.78
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -116,6 +116,23 @@ def _banner(msg: str) -> str:
116
116
  return banner
117
117
 
118
118
 
119
+ def _chunked_print(text: str, lines_per_print: int = 10) -> None:
120
+ """Prints the text in chunks of the specified size."""
121
+ lines = text.splitlines()
122
+ buffer: list[str] = []
123
+
124
+ def flush() -> None:
125
+ if buffer:
126
+ print("\n".join(buffer))
127
+ buffer.clear()
128
+
129
+ for line in lines:
130
+ buffer.append(line)
131
+ if len(buffer) >= lines_per_print:
132
+ flush()
133
+ flush()
134
+
135
+
119
136
  def compile(
120
137
  compiler_root: Path, build_mode: BuildMode, auto_clean: bool, no_platformio: bool
121
138
  ) -> int:
@@ -140,7 +157,11 @@ def compile(
140
157
  cmd_list.append("-v")
141
158
 
142
159
  def _open_process(cmd_list: list[str] = cmd_list) -> subprocess.Popen:
143
- print(_banner("Running command:\n " + subprocess.list2cmdline(cmd_list)))
160
+ print(
161
+ _banner(
162
+ "Build started with command:\n " + subprocess.list2cmdline(cmd_list)
163
+ )
164
+ )
144
165
  out = subprocess.Popen(
145
166
  cmd_list,
146
167
  cwd=compiler_root,
@@ -159,12 +180,11 @@ def compile(
159
180
  assert process.stdout is not None
160
181
  line: str
161
182
  for line in process.stdout:
162
- processed_line = line.replace("fastled/src", "src")
163
- timestamped_line = _timestamp_output(processed_line)
183
+ timestamped_line = _timestamp_output(line)
164
184
  output_lines.append(timestamped_line)
165
185
  process.wait()
166
186
  relative_output = _make_timestamps_relative("\n".join(output_lines))
167
- print(relative_output)
187
+ _chunked_print(relative_output)
168
188
  if process.returncode == 0:
169
189
  print(_banner(f"Compilation successful on attempt {attempt}"))
170
190
  return 0
@@ -4,9 +4,17 @@ import warnings
4
4
  from concurrent.futures import ThreadPoolExecutor
5
5
  from pathlib import Path
6
6
 
7
- COMPILER_ROOT = Path("/js")
8
- COMPILER_DIR = COMPILER_ROOT / "compiler"
9
- FASTLED_COMPILER_DIR = COMPILER_ROOT / "fastled/src/platforms/wasm/compiler"
7
+ SRC_MAPPED_HOST_COMPLER_DIR = Path("/host/fastled/src/platforms/wasm/compiler")
8
+ SRC_STANDARD_HOST_COMPILER_DIR = Path(
9
+ "/js/compiler/fastled/src/platforms/wasm/compiler"
10
+ )
11
+
12
+ COMPILER_TARGET = Path("/js")
13
+
14
+ if SRC_MAPPED_HOST_COMPLER_DIR.exists():
15
+ SRC_COMPILER_DIR = SRC_MAPPED_HOST_COMPLER_DIR
16
+ else:
17
+ SRC_COMPILER_DIR = SRC_STANDARD_HOST_COMPILER_DIR
10
18
 
11
19
  HERE = Path(__file__).parent
12
20
 
@@ -15,7 +23,7 @@ def copy_task(src: str | Path) -> None:
15
23
  src = Path(src)
16
24
  if "entrypoint.sh" in str(src):
17
25
  return
18
- link_dst = COMPILER_ROOT / src.name
26
+ link_dst = COMPILER_TARGET / src.name
19
27
 
20
28
  # Handle shell scripts
21
29
  if src.suffix == ".sh":
@@ -55,10 +63,7 @@ def make_links() -> None:
55
63
  # Get all matching files in compiler directory
56
64
  files = []
57
65
  for pattern in patterns:
58
- files.extend(glob.glob(str(COMPILER_DIR / pattern)))
59
-
60
- for pattern in patterns:
61
- files.extend(glob.glob(str(FASTLED_COMPILER_DIR / pattern)))
66
+ files.extend(glob.glob(str(SRC_COMPILER_DIR / pattern)))
62
67
 
63
68
  # Process files in parallel using ThreadPoolExecutor
64
69
  with ThreadPoolExecutor(max_workers=16) as executor:
@@ -15,11 +15,13 @@ dependencies = [
15
15
  "httpx>=0.28.1",
16
16
  "watchdog>=6.0.0",
17
17
  "download>=0.3.5",
18
+ ########## Begin Docker Manager Dependencies
18
19
  "filelock>=3.16.1",
19
20
  "disklru>=2.0.1",
20
21
  "appdirs>=1.4.4",
21
22
  "rapidfuzz>=3.10.1",
22
23
  "progress>=1.6",
24
+ ########## End Docker Manager Dependencies
23
25
  "fastapi>=0.115.12",
24
26
  "uvicorn>=0.34.2",
25
27
  "pywebview>=5.4",
@@ -7,17 +7,14 @@ from typing import Generator
7
7
 
8
8
  from .compile_server import CompileServer
9
9
  from .live_client import LiveClient
10
+ from .settings import DOCKER_FILE, IMAGE_NAME
10
11
  from .site.build import build
11
12
  from .types import BuildMode, CompileResult, CompileServerError
12
13
 
13
14
  # IMPORTANT! There's a bug in github which will REJECT any version update
14
15
  # that has any other change in the repo. Please bump the version as the
15
16
  # ONLY change in a commit, or else the pypi update and the release will fail.
16
- __version__ = "1.2.76"
17
-
18
- DOCKER_FILE = (
19
- "https://raw.githubusercontent.com/zackees/fastled-wasm/refs/heads/main/Dockerfile"
20
- )
17
+ __version__ = "1.2.78"
21
18
 
22
19
 
23
20
  class Api:
@@ -154,7 +151,6 @@ class Docker:
154
151
  @staticmethod
155
152
  def purge() -> None:
156
153
  from fastled.docker_manager import DockerManager
157
- from fastled.settings import IMAGE_NAME
158
154
 
159
155
  docker_mgr = DockerManager()
160
156
  docker_mgr.purge(image_name=IMAGE_NAME)
@@ -217,4 +213,5 @@ __all__ = [
217
213
  "CompileResult",
218
214
  "CompileServerError",
219
215
  "BuildMode",
216
+ "DOCKER_FILE",
220
217
  ]
@@ -68,19 +68,37 @@ def main() -> int:
68
68
  print("Building is disabled")
69
69
  build = False
70
70
 
71
- if build:
72
- raise NotImplementedError("Building is not yet supported.")
71
+ if interactive:
72
+ # raise NotImplementedError("Building is not yet supported.")
73
73
  file_watcher_set(False)
74
- project_root = Path(".").absolute()
75
- print(f"Building Docker image at {project_root}")
76
- from fastled import Api, Docker
77
-
78
- server = Docker.spawn_server_from_fastled_repo(
79
- project_root=project_root,
74
+ # project_root = Path(".").absolute()
75
+ # print(f"Building Docker image at {project_root}")
76
+ from fastled import Api
77
+
78
+ # server = Docker.spawn_server_from_fastled_repo(
79
+ # project_root=project_root,
80
+ # interactive=interactive,
81
+ # sketch_folder=directory,
82
+ # )
83
+ # assert isinstance(server, CompileServer)
84
+ server: CompileServer = CompileServer(
80
85
  interactive=interactive,
81
- sketch_folder=directory,
86
+ auto_updates=False,
87
+ mapped_dir=directory,
88
+ auto_start=False,
89
+ remove_previous=False,
82
90
  )
83
- assert isinstance(server, CompileServer)
91
+
92
+ server.start(wait_for_startup=False)
93
+
94
+ try:
95
+ while server.process_running():
96
+ # wait for ctrl-c
97
+ time.sleep(0.1)
98
+ except KeyboardInterrupt:
99
+ print("\nExiting from server...")
100
+ server.stop()
101
+ return 0
84
102
 
85
103
  try:
86
104
  if interactive:
@@ -0,0 +1,21 @@
1
+ import sys
2
+
3
+ from fastled.app import main as app_main
4
+
5
+ if __name__ == "__main__":
6
+ # Note that the entry point for the exe is in cli.py
7
+ try:
8
+ import os
9
+
10
+ os.chdir("../fastled")
11
+ # sys.argv.append("--server")
12
+ # sys.argv.append("--local")
13
+ sys.argv.append("examples/FxWave2d")
14
+ sys.argv.append("-i")
15
+ sys.exit(app_main())
16
+ except KeyboardInterrupt:
17
+ print("\nExiting from main...")
18
+ sys.exit(1)
19
+ except Exception as e:
20
+ print(f"Error: {e}")
21
+ sys.exit(1)
@@ -381,12 +381,12 @@ def run_client_server(args: Args) -> int:
381
381
  url, compile_server = _try_start_server_or_get_url(auto_update, web, localhost)
382
382
  except KeyboardInterrupt:
383
383
  print("\nExiting from first try...")
384
- if compile_server:
384
+ if compile_server is not None:
385
385
  compile_server.stop()
386
386
  return 1
387
387
  except Exception as e:
388
388
  print(f"Error: {e}")
389
- if compile_server:
389
+ if compile_server is not None:
390
390
  compile_server.stop()
391
391
  return 1
392
392
 
@@ -15,7 +15,6 @@ from fastled.docker_manager import (
15
15
  RunningContainer,
16
16
  Volume,
17
17
  )
18
- from fastled.interactive_srcs import INTERACTIVE_SOURCES
19
18
  from fastled.settings import DEFAULT_CONTAINER_NAME, IMAGE_NAME, SERVER_PORT
20
19
  from fastled.sketch import looks_like_fastled_repo
21
20
  from fastled.types import BuildMode, CompileResult, CompileServerError
@@ -37,6 +36,32 @@ def _try_get_fastled_src(path: Path) -> Path | None:
37
36
  return None
38
37
 
39
38
 
39
+ def _port_is_free(port: int) -> bool:
40
+ """Check if a port is free."""
41
+ import socket
42
+
43
+ with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock:
44
+ try:
45
+ _ = sock.bind(("localhost", port)) and sock.bind(("0.0.0.0", port))
46
+ return True
47
+ except OSError:
48
+ return False
49
+
50
+
51
+ def _find_free_port() -> int:
52
+ """Find a free port on the system."""
53
+
54
+ start_port = 49152
55
+ tries = 10
56
+
57
+ for port in range(start_port, start_port + tries):
58
+ if _port_is_free(port):
59
+ return port
60
+ raise RuntimeError(
61
+ f"No free port found in the range {start_port}-{start_port + tries - 1}"
62
+ )
63
+
64
+
40
65
  class CompileServerImpl:
41
66
  def __init__(
42
67
  self,
@@ -202,6 +227,7 @@ class CompileServerImpl:
202
227
  image_name=IMAGE_NAME, tag="latest", upgrade=upgrade
203
228
  )
204
229
  DISK_CACHE.put("last-update", now_str)
230
+ CLIENT_PORT = 80 # TODO: Don't use port 80.
205
231
 
206
232
  print("Docker image now validated")
207
233
  port = SERVER_PORT
@@ -209,7 +235,11 @@ class CompileServerImpl:
209
235
  server_command = ["/bin/bash"]
210
236
  else:
211
237
  server_command = ["python", "/js/run.py", "server"] + SERVER_OPTIONS
212
- ports = {80: port}
238
+ if self.interactive:
239
+ print("Disabling port forwarding in interactive mode")
240
+ ports = {}
241
+ else:
242
+ ports = {CLIENT_PORT: port}
213
243
  volumes = []
214
244
  if self.fastled_src_dir:
215
245
  print(
@@ -238,20 +268,39 @@ class CompileServerImpl:
238
268
  )
239
269
  if self.fastled_src_dir is not None:
240
270
  # to allow for interactive compilation
241
- interactive_sources = list(INTERACTIVE_SOURCES)
242
- for src in interactive_sources:
243
- src_path = Path(src).absolute()
271
+ # interactive_sources = list(INTERACTIVE_SOURCES)
272
+ interactive_sources: list[tuple[Path, str]] = []
273
+ init_runtime_py = (
274
+ Path(self.fastled_src_dir)
275
+ / ".."
276
+ / ".."
277
+ / "fastled-wasm"
278
+ / "compiler"
279
+ / "init_runtime.py"
280
+ )
281
+ if init_runtime_py.exists():
282
+ # fastled-wasm is in a sister directory, mapping this in to the container.
283
+ mapping = (
284
+ init_runtime_py,
285
+ "/js/init_runtime.py",
286
+ )
287
+ interactive_sources.append(mapping)
288
+
289
+ src_host: Path
290
+ dst_container: str
291
+ for src_host, dst_container in interactive_sources:
292
+ src_path = Path(src_host).absolute()
244
293
  if src_path.exists():
245
- print(f"Mounting {src} into container")
294
+ print(f"Mounting {src_host} into container")
246
295
  volumes.append(
247
296
  Volume(
248
297
  host_path=str(src_path),
249
- container_path=f"/js/fastled/{src}",
298
+ container_path=dst_container,
250
299
  mode="rw",
251
300
  )
252
301
  )
253
302
  else:
254
- print(f"Could not find {src}")
303
+ print(f"Could not find {src_path}")
255
304
 
256
305
  cmd_str = subprocess.list2cmdline(server_command)
257
306
  if not self.interactive:
@@ -269,6 +318,13 @@ class CompileServerImpl:
269
318
  print("Compile server starting")
270
319
  return port
271
320
  else:
321
+ client_port_mapped = CLIENT_PORT in ports
322
+ port_is_free = _port_is_free(CLIENT_PORT)
323
+ if client_port_mapped and port_is_free:
324
+ warnings.warn(
325
+ f"Can't expose port {CLIENT_PORT}, disabling port forwarding in interactive mode"
326
+ )
327
+ ports = {}
272
328
  self.docker.run_container_interactive(
273
329
  image_name=IMAGE_NAME,
274
330
  tag="latest",
@@ -39,6 +39,10 @@ def _handle_ino_cpp(line: str) -> str:
39
39
  return line
40
40
 
41
41
 
42
+ def _handle_fastled_src(line: str) -> str:
43
+ return line.replace("fastled/src", "src")
44
+
45
+
42
46
  class PrintFilterDefault(PrintFilter):
43
47
  """Provides default filtering for FastLED output."""
44
48
 
@@ -61,6 +65,9 @@ class PrintFilterFastled(PrintFilter):
61
65
  # print(line)
62
66
  if "# WASM is building" in line:
63
67
  self.build_started = True
68
+ line = _handle_fastled_src(
69
+ line
70
+ ) # Always convert fastled/src to src for file matchups.
64
71
  if self.build_started or " error: " in line:
65
72
  line = _handle_ino_cpp(line)
66
73
  out.append(line)
@@ -12,3 +12,7 @@ SERVER_PORT = 9021
12
12
  IMAGE_NAME = "niteris/fastled-wasm"
13
13
  DEFAULT_CONTAINER_NAME = "fastled-wasm-compiler"
14
14
  # IMAGE_TAG = "latest"
15
+
16
+ DOCKER_FILE = (
17
+ "https://raw.githubusercontent.com/zackees/fastled-wasm/refs/heads/main/Dockerfile"
18
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastled
3
- Version: 1.2.76
3
+ Version: 1.2.78
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -65,12 +65,12 @@ src/fastled/__init__.py
65
65
  src/fastled/app.py
66
66
  src/fastled/cli.py
67
67
  src/fastled/cli_test.py
68
+ src/fastled/cli_test_interactive.py
68
69
  src/fastled/client_server.py
69
70
  src/fastled/compile_server.py
70
71
  src/fastled/compile_server_impl.py
71
72
  src/fastled/docker_manager.py
72
73
  src/fastled/filewatcher.py
73
- src/fastled/interactive_srcs.py
74
74
  src/fastled/keyboard.py
75
75
  src/fastled/keyz.py
76
76
  src/fastled/live_client.py
@@ -1,5 +0,0 @@
1
- INTERACTIVE_SOURCES: list[str] = [
2
- "/js/compiler/CMakeLists.txt",
3
- "/js/compiler/build_archive.sh",
4
- "/js/compiler/build.sh",
5
- ]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes