fastled 1.1.18__py2.py3-none-any.whl → 1.1.20__py2.py3-none-any.whl

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/__init__.py CHANGED
@@ -1,3 +1,3 @@
1
1
  """FastLED Wasm Compiler package."""
2
2
 
3
- __version__ = "1.1.18"
3
+ __version__ = "1.1.20"
fastled/app.py CHANGED
@@ -20,7 +20,11 @@ from fastled.docker_manager import DockerManager
20
20
  from fastled.filewatcher import FileWatcherProcess
21
21
  from fastled.keyboard import SpaceBarWatcher
22
22
  from fastled.open_browser import open_browser_thread
23
- from fastled.sketch import looks_like_fastled_repo, looks_like_sketch_directory
23
+ from fastled.sketch import (
24
+ find_sketch_directories,
25
+ looks_like_fastled_repo,
26
+ looks_like_sketch_directory,
27
+ )
24
28
  from fastled.web_compile import (
25
29
  SERVER_PORT,
26
30
  ConnectionResult,
@@ -135,7 +139,7 @@ def parse_args() -> argparse.Namespace:
135
139
  if not cwd_is_fastled and not args.localhost and not args.web and not args.server:
136
140
  print(f"Using web compiler at {DEFAULT_URL}")
137
141
  args.web = DEFAULT_URL
138
- if cwd_is_fastled and not args.web:
142
+ if cwd_is_fastled and not args.web and not args.server:
139
143
  print("Forcing --local mode because we are in the FastLED repo")
140
144
  args.localhost = True
141
145
  if args.localhost:
@@ -149,10 +153,31 @@ def parse_args() -> argparse.Namespace:
149
153
  if looks_like_sketch_directory(maybe_sketch_dir):
150
154
  args.directory = str(maybe_sketch_dir)
151
155
  else:
152
- print(
153
- "\nYou either need to specify a sketch directory or run in --server mode."
154
- )
155
- sys.exit(1)
156
+ sketch_directories = find_sketch_directories(maybe_sketch_dir)
157
+ if len(sketch_directories) == 1:
158
+ print(f"\nUsing sketch directory: {sketch_directories[0]}")
159
+ args.directory = str(sketch_directories[0])
160
+ elif len(sketch_directories) > 1:
161
+ print("\nMultiple Directories found, choose one:")
162
+ for i, sketch_dir in enumerate(sketch_directories):
163
+ print(f" [{i+1}]: {sketch_dir}")
164
+ which = input("\nPlease specify a sketch directory: ")
165
+ try:
166
+ index = int(which) - 1
167
+ args.directory = str(sketch_directories[index])
168
+ except (ValueError, IndexError):
169
+ print("Invalid selection.")
170
+ sys.exit(1)
171
+ else:
172
+ print(
173
+ "\nYou either need to specify a sketch directory or run in --server mode."
174
+ )
175
+ sys.exit(1)
176
+ elif args.directory is not None and os.path.isfile(args.directory):
177
+ dir_path = Path(args.directory).parent
178
+ if looks_like_sketch_directory(dir_path):
179
+ print(f"Using sketch directory: {dir_path}")
180
+ args.directory = str(dir_path)
156
181
 
157
182
  return args
158
183
 
@@ -313,7 +338,6 @@ def run_client(args: argparse.Namespace) -> int:
313
338
 
314
339
  if not result.success:
315
340
  print("\nCompilation failed.")
316
- return 1
317
341
 
318
342
  browser_proc: subprocess.Popen | None = None
319
343
  if open_web_browser:
fastled/docker_manager.py CHANGED
@@ -89,8 +89,19 @@ class RunningContainer:
89
89
 
90
90
  class DockerManager:
91
91
  def __init__(self) -> None:
92
- self.client: DockerClient = docker.from_env()
93
- self.first_run = False
92
+ try:
93
+ self._client: DockerClient | None = None
94
+ self.first_run = False
95
+ except docker.errors.DockerException as e:
96
+ stack = traceback.format_exc()
97
+ warnings.warn(f"Error initializing Docker client: {e}\n{stack}")
98
+ raise
99
+
100
+ @property
101
+ def client(self) -> DockerClient:
102
+ if self._client is None:
103
+ self._client = docker.from_env()
104
+ return self._client
94
105
 
95
106
  @staticmethod
96
107
  def is_docker_installed() -> bool:
@@ -120,6 +131,9 @@ class DockerManager:
120
131
  except docker.errors.DockerException as e:
121
132
  print(f"Docker is not running: {str(e)}")
122
133
  return False
134
+ except Exception as e:
135
+ print(f"Error pinging Docker daemon: {str(e)}")
136
+ return False
123
137
 
124
138
  def start(self) -> bool:
125
139
  """Attempt to start Docker Desktop (or the Docker daemon) automatically."""
fastled/sketch.py CHANGED
@@ -2,6 +2,27 @@ import os
2
2
  from pathlib import Path
3
3
 
4
4
 
5
+ def find_sketch_directories(directory: Path) -> list[Path]:
6
+ sketch_directories: list[Path] = []
7
+ # search all the paths one level deep
8
+ for path in directory.iterdir():
9
+ if path.is_dir():
10
+ dir_name = path.name
11
+ if str(dir_name).startswith("."):
12
+ continue
13
+
14
+ if looks_like_sketch_directory(path, quick=True):
15
+ sketch_directories.append(path)
16
+ if dir_name.lower() == "examples":
17
+ for example in path.iterdir():
18
+ if example.is_dir():
19
+ if looks_like_sketch_directory(example, quick=True):
20
+ sketch_directories.append(example)
21
+ # make relative to cwd
22
+ sketch_directories = [p.relative_to(directory) for p in sketch_directories]
23
+ return sketch_directories
24
+
25
+
5
26
  def get_sketch_files(directory: Path) -> list[Path]:
6
27
  files: list[Path] = []
7
28
  for root, dirs, filenames in os.walk(directory):
@@ -30,14 +51,14 @@ def _lots_and_lots_of_files(directory: Path) -> bool:
30
51
  return len(get_sketch_files(directory)) > 100
31
52
 
32
53
 
33
- def looks_like_sketch_directory(directory: Path) -> bool:
54
+ def looks_like_sketch_directory(directory: Path, quick=False) -> bool:
34
55
  if looks_like_fastled_repo(directory):
35
56
  print("Directory looks like the FastLED repo")
36
57
  return False
37
58
 
38
- if _lots_and_lots_of_files(directory):
39
- print("Too many files in the directory, bailing out")
40
- return False
59
+ if not quick:
60
+ if _lots_and_lots_of_files(directory):
61
+ return False
41
62
 
42
63
  # walk the path and if there are over 30 files, return False
43
64
  # at the root of the directory there should either be an ino file or a src directory
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastled
3
- Version: 1.1.18
3
+ Version: 1.1.20
4
4
  Summary: FastLED Wasm Compiler
5
5
  Home-page: https://github.com/zackees/fastled-wasm
6
6
  Maintainer: Zachary Vorhies
@@ -161,6 +161,8 @@ A: A big chunk of space is being used by unnecessary javascript `emscripten` is
161
161
 
162
162
  # Revisions
163
163
 
164
+ * 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.
165
+ * 1.1.19 - Automatically does a limit searches for sketch directories if you leave it blank.
164
166
  * 1.1.18 - Fixes for when the image has never been downloaded.
165
167
  * 1.1.17 - Added `--update` and `--no-auto-update` to control whether the compiler in docker mode will try to update.
166
168
  * 1.1.16 - Rewrote docker logic to use container suspension and resumption. Much much faster.
@@ -1,20 +1,20 @@
1
- fastled/__init__.py,sha256=IHbpe-aq0aVLbSOXEoXCoEu9sNWQTsV5OEghbd4DLsE,64
2
- fastled/app.py,sha256=dUCHM-1yQGrpTtfUCn1NYlG7hIJm_Tg445zhyxsMBhY,15715
1
+ fastled/__init__.py,sha256=p51kZEN1JznXCt_KUL-m7ZWLsSop3-7JuCT0ywmQs3A,64
2
+ fastled/app.py,sha256=gLmma0cWlXgkCGPLt3DQIUAZuU3EdxfzNZfAi0ghEOI,16882
3
3
  fastled/build_mode.py,sha256=joMwsV4K1y_LijT4gEAcjx69RZBoe_KmFmHZdPYbL_4,631
4
4
  fastled/cli.py,sha256=CNR_pQR0sNVPNuv8e_nmm-0PI8sU-eUBUgnWgWkzW9c,237
5
5
  fastled/compile_server.py,sha256=aBdpILSRrDsCJ5e9g5uwIqt9bcqE_8FrSddCV2ygtrI,5401
6
- fastled/docker_manager.py,sha256=AzQBXqWB1Uq_Qb1mp1NS4hIbkC8aYp-pzpYhFRpI5ww,19940
6
+ fastled/docker_manager.py,sha256=5IXaLt8k4WSSiWmvqMvwMYKngAgZ-t2p2deJ6cmJNwk,20434
7
7
  fastled/filewatcher.py,sha256=5dVmjEG23kMeJa29tRVm5XKSr9sTD4ME2boo-CFDuUM,6910
8
8
  fastled/keyboard.py,sha256=rqndglWYzRy6oiqHgsmx1peLd0Yrpci01zGENlCzh_s,2576
9
9
  fastled/open_browser.py,sha256=RRHcsZ5Vzsw1AuZUEYuSfjKmf_9j3NGMDUR-FndHmqs,1483
10
10
  fastled/paths.py,sha256=VsPmgu0lNSCFOoEC0BsTYzDygXqy15AHUfN-tTuzDZA,99
11
- fastled/sketch.py,sha256=KhhPFqlFVlBk8YrzFy7-ioe7zEzecgrVLhyFbLpBp7k,1845
11
+ fastled/sketch.py,sha256=5nRjg281lMH8Bo9wKjbcpTQCfEP574ZCG-lukvFmyQ8,2656
12
12
  fastled/util.py,sha256=t4M3NFMhnCzfYbLvIyJi0RdFssZqbTN_vVIaej1WV-U,265
13
13
  fastled/web_compile.py,sha256=KuvKGdX6SSUUqC7YgX4T9SMSP5wdcPUhpg9-K9zPoTI,10378
14
14
  fastled/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
15
- fastled-1.1.18.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
16
- fastled-1.1.18.dist-info/METADATA,sha256=5crAxI6_10i2pfPFIX8KxFCmX_3yyvGWZKjBR6JIRMU,13562
17
- fastled-1.1.18.dist-info/WHEEL,sha256=0VNUDWQJzfRahYI3neAhz2UVbRCtztpN5dPHAGvmGXc,109
18
- fastled-1.1.18.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
19
- fastled-1.1.18.dist-info/top_level.txt,sha256=xfG6Z_ol9V5YmBROkZq2QTRwjbS2ouCUxaTJsOwfkOo,14
20
- fastled-1.1.18.dist-info/RECORD,,
15
+ fastled-1.1.20.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
16
+ fastled-1.1.20.dist-info/METADATA,sha256=XyDrNrK_WIiy21Xj_xlIWUgfdMiZ0KGDnasYL-or2Xg,13814
17
+ fastled-1.1.20.dist-info/WHEEL,sha256=0VNUDWQJzfRahYI3neAhz2UVbRCtztpN5dPHAGvmGXc,109
18
+ fastled-1.1.20.dist-info/entry_points.txt,sha256=RCwmzCSOS4-C2i9EziANq7Z2Zb4KFnEMR1FQC0bBwAw,101
19
+ fastled-1.1.20.dist-info/top_level.txt,sha256=xfG6Z_ol9V5YmBROkZq2QTRwjbS2ouCUxaTJsOwfkOo,14
20
+ fastled-1.1.20.dist-info/RECORD,,