fastled 1.1.21__tar.gz → 1.1.23__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 (101) hide show
  1. {fastled-1.1.21 → fastled-1.1.23}/PKG-INFO +5 -1
  2. {fastled-1.1.21 → fastled-1.1.23}/README.md +3 -0
  3. {fastled-1.1.21 → fastled-1.1.23}/pyproject.toml +1 -0
  4. {fastled-1.1.21 → fastled-1.1.23}/src/fastled/__init__.py +1 -1
  5. {fastled-1.1.21 → fastled-1.1.23}/src/fastled/app.py +202 -197
  6. {fastled-1.1.21 → fastled-1.1.23}/src/fastled/client_server.py +7 -6
  7. {fastled-1.1.21 → fastled-1.1.23}/src/fastled/docker_manager.py +530 -526
  8. {fastled-1.1.21 → fastled-1.1.23}/src/fastled/keyboard.py +8 -6
  9. fastled-1.1.23/src/fastled/select_sketch_directory.py +35 -0
  10. fastled-1.1.23/src/fastled/string_diff.py +37 -0
  11. {fastled-1.1.21 → fastled-1.1.23}/src/fastled.egg-info/PKG-INFO +5 -1
  12. {fastled-1.1.21 → fastled-1.1.23}/src/fastled.egg-info/SOURCES.txt +2 -0
  13. {fastled-1.1.21 → fastled-1.1.23}/src/fastled.egg-info/requires.txt +1 -0
  14. {fastled-1.1.21 → fastled-1.1.23}/tests/test_ino/bad/bad.ino +2 -2
  15. {fastled-1.1.21/tests/test_ino/wasm → fastled-1.1.23/tests/test_ino/embedded}/wasm.ino +2 -2
  16. {fastled-1.1.21/tests/test_ino/embedded → fastled-1.1.23/tests/test_ino/wasm}/wasm.ino +2 -2
  17. {fastled-1.1.21 → fastled-1.1.23}/.aiderignore +0 -0
  18. {fastled-1.1.21 → fastled-1.1.23}/.github/workflows/build_multi_docker_image.yml +0 -0
  19. {fastled-1.1.21 → fastled-1.1.23}/.github/workflows/lint.yml +0 -0
  20. {fastled-1.1.21 → fastled-1.1.23}/.github/workflows/test_macos.yml +0 -0
  21. {fastled-1.1.21 → fastled-1.1.23}/.github/workflows/test_ubuntu.yml +0 -0
  22. {fastled-1.1.21 → fastled-1.1.23}/.github/workflows/test_win.yml +0 -0
  23. {fastled-1.1.21 → fastled-1.1.23}/.gitignore +0 -0
  24. {fastled-1.1.21 → fastled-1.1.23}/.pylintrc +0 -0
  25. {fastled-1.1.21 → fastled-1.1.23}/.vscode/launch.json +0 -0
  26. {fastled-1.1.21 → fastled-1.1.23}/.vscode/settings.json +0 -0
  27. {fastled-1.1.21 → fastled-1.1.23}/.vscode/tasks.json +0 -0
  28. {fastled-1.1.21 → fastled-1.1.23}/LICENSE +0 -0
  29. {fastled-1.1.21 → fastled-1.1.23}/MANIFEST.in +0 -0
  30. {fastled-1.1.21 → fastled-1.1.23}/clean +0 -0
  31. {fastled-1.1.21 → fastled-1.1.23}/docs/fastled.js +0 -0
  32. {fastled-1.1.21 → fastled-1.1.23}/docs/fastled.wasm +0 -0
  33. {fastled-1.1.21 → fastled-1.1.23}/docs/index.css +0 -0
  34. {fastled-1.1.21 → fastled-1.1.23}/docs/index.html +0 -0
  35. {fastled-1.1.21 → fastled-1.1.23}/docs/index.js +0 -0
  36. {fastled-1.1.21 → fastled-1.1.23}/examples/Blink/Blink.ino +0 -0
  37. {fastled-1.1.21 → fastled-1.1.23}/examples/Chromancer/Chromancer.ino +0 -0
  38. {fastled-1.1.21 → fastled-1.1.23}/examples/Chromancer/detail.h +0 -0
  39. {fastled-1.1.21 → fastled-1.1.23}/examples/Chromancer/gary_woos_wled_port/gary_woos_wled_ledmap.h +0 -0
  40. {fastled-1.1.21 → fastled-1.1.23}/examples/Chromancer/gary_woos_wled_port/presets.json +0 -0
  41. {fastled-1.1.21 → fastled-1.1.23}/examples/Chromancer/gary_woos_wled_port/presets.min.json +0 -0
  42. {fastled-1.1.21 → fastled-1.1.23}/examples/Chromancer/gen.py +0 -0
  43. {fastled-1.1.21 → fastled-1.1.23}/examples/Chromancer/mapping.h +0 -0
  44. {fastled-1.1.21 → fastled-1.1.23}/examples/Chromancer/net.h +0 -0
  45. {fastled-1.1.21 → fastled-1.1.23}/examples/Chromancer/output.json +0 -0
  46. {fastled-1.1.21 → fastled-1.1.23}/examples/Chromancer/ripple.h +0 -0
  47. {fastled-1.1.21 → fastled-1.1.23}/examples/Chromancer/screenmap.json.h +0 -0
  48. {fastled-1.1.21 → fastled-1.1.23}/examples/ColorPalette/ColorPalette.ino +0 -0
  49. {fastled-1.1.21 → fastled-1.1.23}/examples/ColorTemperature/ColorTemperature.ino +0 -0
  50. {fastled-1.1.21 → fastled-1.1.23}/examples/Cylon/Cylon.ino +0 -0
  51. {fastled-1.1.21 → fastled-1.1.23}/examples/DemoReel100/DemoReel100.ino +0 -0
  52. {fastled-1.1.21 → fastled-1.1.23}/examples/Esp32Rmt51/Esp32Rmt51.ino +0 -0
  53. {fastled-1.1.21 → fastled-1.1.23}/examples/EspI2SDemo/EspI2SDemo.ino +0 -0
  54. {fastled-1.1.21 → fastled-1.1.23}/examples/Fire2012/Fire2012.ino +0 -0
  55. {fastled-1.1.21 → fastled-1.1.23}/examples/Fire2012WithPalette/Fire2012WithPalette.ino +0 -0
  56. {fastled-1.1.21 → fastled-1.1.23}/examples/FirstLight/FirstLight.ino +0 -0
  57. {fastled-1.1.21 → fastled-1.1.23}/examples/FxEngine/FxEngine.ino +0 -0
  58. {fastled-1.1.21 → fastled-1.1.23}/examples/Noise/Noise.ino +0 -0
  59. {fastled-1.1.21 → fastled-1.1.23}/examples/NoisePlayground/NoisePlayground.ino +0 -0
  60. {fastled-1.1.21 → fastled-1.1.23}/examples/NoisePlusPalette/NoisePlusPalette.ino +0 -0
  61. {fastled-1.1.21 → fastled-1.1.23}/examples/OctoWS2811/OctoWS2811.ino +0 -0
  62. {fastled-1.1.21 → fastled-1.1.23}/examples/Pacifica/Pacifica.ino +0 -0
  63. {fastled-1.1.21 → fastled-1.1.23}/examples/Pride2015/Pride2015.ino +0 -0
  64. {fastled-1.1.21 → fastled-1.1.23}/examples/SdCard/SdCard.ino +0 -0
  65. {fastled-1.1.21 → fastled-1.1.23}/examples/SdCard/screenmap.json.h +0 -0
  66. {fastled-1.1.21 → fastled-1.1.23}/examples/TwinkleFox/TwinkleFox.ino +0 -0
  67. {fastled-1.1.21 → fastled-1.1.23}/examples/Video/Gfx2Video/Gfx2Video.ino +0 -0
  68. {fastled-1.1.21 → fastled-1.1.23}/examples/WasmScreenCoords/WasmScreenCoords.ino +0 -0
  69. {fastled-1.1.21 → fastled-1.1.23}/examples/Water/Water.ino +0 -0
  70. {fastled-1.1.21 → fastled-1.1.23}/examples/XYMatrix/XYMatrix.ino +0 -0
  71. {fastled-1.1.21 → fastled-1.1.23}/examples/wasm/wasm.ino +0 -0
  72. {fastled-1.1.21 → fastled-1.1.23}/install +0 -0
  73. {fastled-1.1.21 → fastled-1.1.23}/lint +0 -0
  74. {fastled-1.1.21 → fastled-1.1.23}/requirements.testing.txt +0 -0
  75. {fastled-1.1.21 → fastled-1.1.23}/setup.cfg +0 -0
  76. {fastled-1.1.21 → fastled-1.1.23}/setup.py +0 -0
  77. {fastled-1.1.21 → fastled-1.1.23}/src/fastled/assets/example.txt +0 -0
  78. {fastled-1.1.21 → fastled-1.1.23}/src/fastled/build_mode.py +0 -0
  79. {fastled-1.1.21 → fastled-1.1.23}/src/fastled/cli.py +0 -0
  80. {fastled-1.1.21 → fastled-1.1.23}/src/fastled/compile_server.py +0 -0
  81. {fastled-1.1.21 → fastled-1.1.23}/src/fastled/env.py +0 -0
  82. {fastled-1.1.21 → fastled-1.1.23}/src/fastled/filewatcher.py +0 -0
  83. {fastled-1.1.21 → fastled-1.1.23}/src/fastled/open_browser.py +0 -0
  84. {fastled-1.1.21 → fastled-1.1.23}/src/fastled/paths.py +0 -0
  85. {fastled-1.1.21 → fastled-1.1.23}/src/fastled/sketch.py +0 -0
  86. {fastled-1.1.21 → fastled-1.1.23}/src/fastled/types.py +0 -0
  87. {fastled-1.1.21 → fastled-1.1.23}/src/fastled/util.py +0 -0
  88. {fastled-1.1.21 → fastled-1.1.23}/src/fastled/web_compile.py +0 -0
  89. {fastled-1.1.21 → fastled-1.1.23}/src/fastled.egg-info/dependency_links.txt +0 -0
  90. {fastled-1.1.21 → fastled-1.1.23}/src/fastled.egg-info/entry_points.txt +0 -0
  91. {fastled-1.1.21 → fastled-1.1.23}/src/fastled.egg-info/top_level.txt +0 -0
  92. {fastled-1.1.21 → fastled-1.1.23}/test +0 -0
  93. {fastled-1.1.21 → fastled-1.1.23}/tests/test_bad_ino.py +0 -0
  94. {fastled-1.1.21 → fastled-1.1.23}/tests/test_cli.py +0 -0
  95. {fastled-1.1.21 → fastled-1.1.23}/tests/test_compile_server.py +0 -0
  96. {fastled-1.1.21 → fastled-1.1.23}/tests/test_embedded_data.py +0 -0
  97. {fastled-1.1.21 → fastled-1.1.23}/tests/test_filechanger.py +0 -0
  98. {fastled-1.1.21 → fastled-1.1.23}/tests/test_ino/embedded/data/bigdata.dat +0 -0
  99. {fastled-1.1.21 → fastled-1.1.23}/tests/test_server_and_client_seperatly.py +0 -0
  100. {fastled-1.1.21 → fastled-1.1.23}/tests/test_webcompile.py +0 -0
  101. {fastled-1.1.21 → fastled-1.1.23}/upload_package.sh +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastled
3
- Version: 1.1.21
3
+ Version: 1.1.23
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -18,6 +18,7 @@ Requires-Dist: download
18
18
  Requires-Dist: filelock
19
19
  Requires-Dist: disklru>=2.0.1
20
20
  Requires-Dist: appdirs
21
+ Requires-Dist: rapidfuzz
21
22
 
22
23
  # FastLED Wasm compiler
23
24
 
@@ -31,6 +32,7 @@ Compiles an Arduino/Platformio sketch into a wasm binary that can be run directl
31
32
  [![Win_Tests](https://github.com/zackees/fastled-wasm/actions/workflows/test_win.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/test_win.yml)
32
33
 
33
34
 
35
+
34
36
  # About
35
37
 
36
38
  This python app will compile your FastLED style sketches into html/js/wasm output that runs directly in the browser.
@@ -161,6 +163,8 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` is
161
163
 
162
164
  # Revisions
163
165
 
166
+ * 1.1.23 - Various fixes for MacOS
167
+ * 1.1.22 - Selecting sketch now allows strings and narrowing down paths if ambiguity
164
168
  * 1.1.21 - Now always watches for space/enter key events to trigger a recompile.
165
169
  * 1.1.20 - Fixed a regression for 1.1.16 involving docker throwing an exception before DockerManager.is_running() could be called so it can be launched.
166
170
  * 1.1.19 - Automatically does a limit searches for sketch directories if you leave it blank.
@@ -10,6 +10,7 @@ Compiles an Arduino/Platformio sketch into a wasm binary that can be run directl
10
10
  [![Win_Tests](https://github.com/zackees/fastled-wasm/actions/workflows/test_win.yml/badge.svg)](https://github.com/zackees/fastled-wasm/actions/workflows/test_win.yml)
11
11
 
12
12
 
13
+
13
14
  # About
14
15
 
15
16
  This python app will compile your FastLED style sketches into html/js/wasm output that runs directly in the browser.
@@ -140,6 +141,8 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` is
140
141
 
141
142
  # Revisions
142
143
 
144
+ * 1.1.23 - Various fixes for MacOS
145
+ * 1.1.22 - Selecting sketch now allows strings and narrowing down paths if ambiguity
143
146
  * 1.1.21 - Now always watches for space/enter key events to trigger a recompile.
144
147
  * 1.1.20 - Fixed a regression for 1.1.16 involving docker throwing an exception before DockerManager.is_running() could be called so it can be launched.
145
148
  * 1.1.19 - Automatically does a limit searches for sketch directories if you leave it blank.
@@ -19,6 +19,7 @@ dependencies = [
19
19
  "filelock",
20
20
  "disklru>=2.0.1",
21
21
  "appdirs",
22
+ "rapidfuzz",
22
23
  ]
23
24
 
24
25
  dynamic = ["version"]
@@ -1,3 +1,3 @@
1
1
  """FastLED Wasm Compiler package."""
2
2
 
3
- __version__ = "1.1.21"
3
+ __version__ = "1.1.23"
@@ -1,197 +1,202 @@
1
- """
2
- Uses the latest wasm compiler image to compile the FastLED sketch.
3
- """
4
-
5
- import argparse
6
- import os
7
- import sys
8
- import time
9
- from pathlib import Path
10
-
11
- from fastled import __version__
12
- from fastled.client_server import run_client_server
13
- from fastled.compile_server import CompileServer
14
- from fastled.env import DEFAULT_URL
15
- from fastled.sketch import (
16
- find_sketch_directories,
17
- looks_like_fastled_repo,
18
- looks_like_sketch_directory,
19
- )
20
-
21
-
22
- def parse_args() -> argparse.Namespace:
23
- """Parse command-line arguments."""
24
- parser = argparse.ArgumentParser(description=f"FastLED WASM Compiler {__version__}")
25
- parser.add_argument(
26
- "--version", action="version", version=f"%(prog)s {__version__}"
27
- )
28
- parser.add_argument(
29
- "directory",
30
- type=str,
31
- nargs="?",
32
- default=None,
33
- help="Directory containing the FastLED sketch to compile",
34
- )
35
- parser.add_argument(
36
- "--just-compile",
37
- action="store_true",
38
- help="Just compile, skip opening the browser and watching for changes.",
39
- )
40
- parser.add_argument(
41
- "--web",
42
- "-w",
43
- type=str,
44
- nargs="?",
45
- # const does not seem to be working as expected
46
- const=DEFAULT_URL, # Default value when --web is specified without value
47
- help="Use web compiler. Optional URL can be provided (default: https://fastled.onrender.com)",
48
- )
49
- parser.add_argument(
50
- "-i",
51
- "--interactive",
52
- action="store_true",
53
- help="Run in interactive mode (Not available with --web)",
54
- )
55
- parser.add_argument(
56
- "--profile",
57
- action="store_true",
58
- help="Enable profiling for web compilation",
59
- )
60
- parser.add_argument(
61
- "--force-compile",
62
- action="store_true",
63
- help="Skips the test to see if the current directory is a valid FastLED sketch directory",
64
- )
65
- parser.add_argument(
66
- "--no-auto-updates",
67
- action="store_true",
68
- help="Disable automatic updates of the wasm compiler image when using docker.",
69
- )
70
- parser.add_argument(
71
- "--update",
72
- action="store_true",
73
- help="Update the wasm compiler (if necessary) before running",
74
- )
75
- parser.add_argument(
76
- "--localhost",
77
- "--local",
78
- "-l",
79
- action="store_true",
80
- help="Use localhost for web compilation from an instance of fastled --server, creating it if necessary",
81
- )
82
- parser.add_argument(
83
- "--server",
84
- "-s",
85
- action="store_true",
86
- help="Run the server in the current directory, volume mapping fastled if we are in the repo",
87
- )
88
- build_mode = parser.add_mutually_exclusive_group()
89
- build_mode.add_argument("--debug", action="store_true", help="Build in debug mode")
90
- build_mode.add_argument(
91
- "--quick",
92
- action="store_true",
93
- default=True,
94
- help="Build in quick mode (default)",
95
- )
96
- build_mode.add_argument(
97
- "--release", action="store_true", help="Build in release mode"
98
- )
99
-
100
- cwd_is_fastled = looks_like_fastled_repo(Path(os.getcwd()))
101
-
102
- args = parser.parse_args()
103
- if args.update:
104
- args.auto_update = True
105
- elif args.no_auto_updates:
106
- args.auto_update = False
107
- else:
108
- args.auto_update = None
109
-
110
- if not cwd_is_fastled and not args.localhost and not args.web and not args.server:
111
- print(f"Using web compiler at {DEFAULT_URL}")
112
- args.web = DEFAULT_URL
113
- if cwd_is_fastled and not args.web and not args.server:
114
- print("Forcing --local mode because we are in the FastLED repo")
115
- args.localhost = True
116
- if args.localhost:
117
- args.web = "localhost"
118
- if args.interactive and not args.server:
119
- print("--interactive forces --server mode")
120
- args.server = True
121
- if args.directory is None and not args.server:
122
- # does current directory look like a sketch?
123
- maybe_sketch_dir = Path(os.getcwd())
124
- if looks_like_sketch_directory(maybe_sketch_dir):
125
- args.directory = str(maybe_sketch_dir)
126
- else:
127
- sketch_directories = find_sketch_directories(maybe_sketch_dir)
128
- if len(sketch_directories) == 1:
129
- print(f"\nUsing sketch directory: {sketch_directories[0]}")
130
- args.directory = str(sketch_directories[0])
131
- elif len(sketch_directories) > 1:
132
- print("\nMultiple Directories found, choose one:")
133
- for i, sketch_dir in enumerate(sketch_directories):
134
- print(f" [{i+1}]: {sketch_dir}")
135
- which = input("\nPlease specify a sketch directory: ")
136
- try:
137
- index = int(which) - 1
138
- args.directory = str(sketch_directories[index])
139
- except (ValueError, IndexError):
140
- print("Invalid selection.")
141
- sys.exit(1)
142
- else:
143
- print(
144
- "\nYou either need to specify a sketch directory or run in --server mode."
145
- )
146
- sys.exit(1)
147
- elif args.directory is not None and os.path.isfile(args.directory):
148
- dir_path = Path(args.directory).parent
149
- if looks_like_sketch_directory(dir_path):
150
- print(f"Using sketch directory: {dir_path}")
151
- args.directory = str(dir_path)
152
-
153
- return args
154
-
155
-
156
- def run_server(args: argparse.Namespace) -> int:
157
- interactive = args.interactive
158
- auto_update = args.auto_update
159
- compile_server = CompileServer(interactive=interactive, auto_updates=auto_update)
160
- if not interactive:
161
- print(f"Server started at {compile_server.url()}")
162
- compile_server.wait_for_startup()
163
- try:
164
- while True:
165
- if not compile_server.proceess_running():
166
- print("Server process is not running. Exiting...")
167
- return 1
168
- time.sleep(1)
169
- except KeyboardInterrupt:
170
- print("\nExiting from server...")
171
- return 1
172
- finally:
173
- compile_server.stop()
174
- return 0
175
-
176
-
177
- def main() -> int:
178
- args = parse_args()
179
- if args.server:
180
- print("Running in server only mode.")
181
- return run_server(args)
182
- else:
183
- print("Running in client/server mode.")
184
- return run_client_server(args)
185
-
186
-
187
- if __name__ == "__main__":
188
- try:
189
- os.chdir("../fastled")
190
- sys.argv.append("--server")
191
- sys.exit(main())
192
- except KeyboardInterrupt:
193
- print("\nExiting from main...")
194
- sys.exit(1)
195
- except Exception as e:
196
- print(f"Error: {e}")
197
- sys.exit(1)
1
+ """
2
+ Uses the latest wasm compiler image to compile the FastLED sketch.
3
+ """
4
+
5
+ import argparse
6
+ import os
7
+ import sys
8
+ import time
9
+ from pathlib import Path
10
+
11
+ from fastled import __version__
12
+ from fastled.client_server import run_client_server
13
+ from fastled.compile_server import CompileServer
14
+ from fastled.env import DEFAULT_URL
15
+ from fastled.select_sketch_directory import select_sketch_directory
16
+ from fastled.sketch import (
17
+ find_sketch_directories,
18
+ looks_like_fastled_repo,
19
+ looks_like_sketch_directory,
20
+ )
21
+
22
+
23
+ def parse_args() -> argparse.Namespace:
24
+ """Parse command-line arguments."""
25
+ parser = argparse.ArgumentParser(description=f"FastLED WASM Compiler {__version__}")
26
+ parser.add_argument(
27
+ "--version", action="version", version=f"%(prog)s {__version__}"
28
+ )
29
+ parser.add_argument(
30
+ "directory",
31
+ type=str,
32
+ nargs="?",
33
+ default=None,
34
+ help="Directory containing the FastLED sketch to compile",
35
+ )
36
+ parser.add_argument(
37
+ "--just-compile",
38
+ action="store_true",
39
+ help="Just compile, skip opening the browser and watching for changes.",
40
+ )
41
+ parser.add_argument(
42
+ "--web",
43
+ "-w",
44
+ type=str,
45
+ nargs="?",
46
+ # const does not seem to be working as expected
47
+ const=DEFAULT_URL, # Default value when --web is specified without value
48
+ help="Use web compiler. Optional URL can be provided (default: https://fastled.onrender.com)",
49
+ )
50
+ parser.add_argument(
51
+ "-i",
52
+ "--interactive",
53
+ action="store_true",
54
+ help="Run in interactive mode (Not available with --web)",
55
+ )
56
+ parser.add_argument(
57
+ "--profile",
58
+ action="store_true",
59
+ help="Enable profiling for web compilation",
60
+ )
61
+ parser.add_argument(
62
+ "--force-compile",
63
+ action="store_true",
64
+ help="Skips the test to see if the current directory is a valid FastLED sketch directory",
65
+ )
66
+ parser.add_argument(
67
+ "--no-auto-updates",
68
+ action="store_true",
69
+ help="Disable automatic updates of the wasm compiler image when using docker.",
70
+ )
71
+ parser.add_argument(
72
+ "--update",
73
+ "--upgrade",
74
+ action="store_true",
75
+ help="Update the wasm compiler (if necessary) before running",
76
+ )
77
+ parser.add_argument(
78
+ "--localhost",
79
+ "--local",
80
+ "-l",
81
+ action="store_true",
82
+ help="Use localhost for web compilation from an instance of fastled --server, creating it if necessary",
83
+ )
84
+ parser.add_argument(
85
+ "--server",
86
+ "-s",
87
+ action="store_true",
88
+ help="Run the server in the current directory, volume mapping fastled if we are in the repo",
89
+ )
90
+ build_mode = parser.add_mutually_exclusive_group()
91
+ build_mode.add_argument("--debug", action="store_true", help="Build in debug mode")
92
+ build_mode.add_argument(
93
+ "--quick",
94
+ action="store_true",
95
+ default=True,
96
+ help="Build in quick mode (default)",
97
+ )
98
+ build_mode.add_argument(
99
+ "--release", action="store_true", help="Build in release mode"
100
+ )
101
+
102
+ cwd_is_fastled = looks_like_fastled_repo(Path(os.getcwd()))
103
+
104
+ args = parser.parse_args()
105
+ if not args.update:
106
+ if args.no_auto_updates:
107
+ args.auto_update = False
108
+ else:
109
+ args.auto_update = None
110
+
111
+ if (
112
+ not cwd_is_fastled
113
+ and not args.localhost
114
+ and not args.web
115
+ and not args.server
116
+ ):
117
+ print(f"Using web compiler at {DEFAULT_URL}")
118
+ args.web = DEFAULT_URL
119
+ if cwd_is_fastled and not args.web and not args.server:
120
+ print("Forcing --local mode because we are in the FastLED repo")
121
+ args.localhost = True
122
+ if args.localhost:
123
+ args.web = "localhost"
124
+ if args.interactive and not args.server:
125
+ print("--interactive forces --server mode")
126
+ args.server = True
127
+ if args.directory is None and not args.server:
128
+ # does current directory look like a sketch?
129
+ maybe_sketch_dir = Path(os.getcwd())
130
+ if looks_like_sketch_directory(maybe_sketch_dir):
131
+ args.directory = str(maybe_sketch_dir)
132
+ else:
133
+ sketch_directories = find_sketch_directories(maybe_sketch_dir)
134
+ selected_dir = select_sketch_directory(
135
+ sketch_directories, cwd_is_fastled
136
+ )
137
+ if selected_dir:
138
+ print(f"Using sketch directory: {selected_dir}")
139
+ args.directory = selected_dir
140
+ else:
141
+ print(
142
+ "\nYou either need to specify a sketch directory or run in --server mode."
143
+ )
144
+ sys.exit(1)
145
+ elif args.directory is not None and os.path.isfile(args.directory):
146
+ dir_path = Path(args.directory).parent
147
+ if looks_like_sketch_directory(dir_path):
148
+ print(f"Using sketch directory: {dir_path}")
149
+ args.directory = str(dir_path)
150
+
151
+ return args
152
+
153
+
154
+ def run_server(args: argparse.Namespace) -> int:
155
+ interactive = args.interactive
156
+ auto_update = args.auto_update
157
+ compile_server = CompileServer(interactive=interactive, auto_updates=auto_update)
158
+ if not interactive:
159
+ print(f"Server started at {compile_server.url()}")
160
+ compile_server.wait_for_startup()
161
+ try:
162
+ while True:
163
+ if not compile_server.proceess_running():
164
+ print("Server process is not running. Exiting...")
165
+ return 1
166
+ time.sleep(1)
167
+ except KeyboardInterrupt:
168
+ print("\nExiting from server...")
169
+ return 1
170
+ finally:
171
+ compile_server.stop()
172
+ return 0
173
+
174
+
175
+ def main() -> int:
176
+ args = parse_args()
177
+ if args.update:
178
+ # Force auto_update to ensure update check happens
179
+ compile_server = CompileServer(interactive=False, auto_updates=True)
180
+ compile_server.stop()
181
+ print("Finished updating.")
182
+ return 0
183
+
184
+ if args.server:
185
+ print("Running in server only mode.")
186
+ return run_server(args)
187
+ else:
188
+ print("Running in client/server mode.")
189
+ return run_client_server(args)
190
+
191
+
192
+ if __name__ == "__main__":
193
+ try:
194
+ os.chdir("../fastled")
195
+ sys.argv.append("--upgrade")
196
+ sys.exit(main())
197
+ except KeyboardInterrupt:
198
+ print("\nExiting from main...")
199
+ sys.exit(1)
200
+ except Exception as e:
201
+ print(f"Error: {e}")
202
+ sys.exit(1)
@@ -268,14 +268,15 @@ def run_client_server(args: argparse.Namespace) -> int:
268
268
  space_bar_pressed = SpaceBarWatcher.watch_space_bar_pressed(
269
269
  timeout=1.0
270
270
  )
271
- file_had_changes = (
272
- len(source_code_watcher.get_all_changes()) > 0
273
- )
274
- if space_bar_pressed or file_had_changes:
271
+ file_changes = source_code_watcher.get_all_changes()
272
+
273
+ if space_bar_pressed or file_changes:
275
274
  if space_bar_pressed:
276
275
  print("Space bar pressed, triggering recompile...")
277
- elif file_had_changes:
278
- print("Changes detected, triggering recompile...")
276
+ elif file_changes:
277
+ print(
278
+ f"Changes detected in {','.join(file_changes)}, triggering recompile..."
279
+ )
279
280
  last_compiled_result = compile_function(
280
281
  last_hash_value=None
281
282
  )