fastled 1.4.30__py3-none-any.whl → 1.4.32__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/__version__.py +1 -1
- fastled/app.py +10 -0
- fastled/args.py +15 -0
- fastled/install/__init__.py +1 -0
- fastled/install/examples_manager.py +62 -0
- fastled/install/extension_manager.py +113 -0
- fastled/install/main.py +156 -0
- fastled/install/project_detection.py +167 -0
- fastled/install/test_install.py +373 -0
- fastled/install/vscode_config.py +167 -0
- fastled/open_browser.py +7 -4
- fastled/parse_args.py +45 -0
- fastled/playwright/playwright_browser.py +75 -120
- fastled/playwright/resize_tracking.py +127 -0
- fastled/print_filter.py +52 -52
- fastled/string_diff.py +165 -165
- fastled/version.py +41 -41
- {fastled-1.4.30.dist-info → fastled-1.4.32.dist-info}/METADATA +531 -531
- {fastled-1.4.30.dist-info → fastled-1.4.32.dist-info}/RECORD +23 -15
- {fastled-1.4.30.dist-info → fastled-1.4.32.dist-info}/WHEEL +0 -0
- {fastled-1.4.30.dist-info → fastled-1.4.32.dist-info}/entry_points.txt +0 -0
- {fastled-1.4.30.dist-info → fastled-1.4.32.dist-info}/licenses/LICENSE +0 -0
- {fastled-1.4.30.dist-info → fastled-1.4.32.dist-info}/top_level.txt +0 -0
fastled/__version__.py
CHANGED
@@ -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.4.
|
4
|
+
__version__ = "1.4.32"
|
5
5
|
|
6
6
|
__version_url_latest__ = "https://raw.githubusercontent.com/zackees/fastled-wasm/refs/heads/main/src/fastled/__version__.py"
|
fastled/app.py
CHANGED
@@ -51,6 +51,16 @@ def main() -> int:
|
|
51
51
|
from fastled.select_sketch_directory import select_sketch_directory
|
52
52
|
|
53
53
|
args = parse_args()
|
54
|
+
|
55
|
+
# Handle --install command early
|
56
|
+
if args.install:
|
57
|
+
from fastled.install.main import fastled_install
|
58
|
+
|
59
|
+
result = fastled_install(
|
60
|
+
dry_run=args.dry_run, no_interactive=args.no_interactive
|
61
|
+
)
|
62
|
+
return 0 if result else 1
|
63
|
+
|
54
64
|
interactive: bool = args.interactive
|
55
65
|
has_server = args.server
|
56
66
|
update: bool = args.update
|
fastled/args.py
CHANGED
@@ -26,6 +26,9 @@ class Args:
|
|
26
26
|
release: bool
|
27
27
|
ram_disk_size: str # suffixed liked "25mb" or "1gb"
|
28
28
|
clear = False # Force the last running container to be removed. Useful for benchmarking.
|
29
|
+
install: bool = False # Install FastLED development environment
|
30
|
+
dry_run: bool = False # Dry run mode for testing
|
31
|
+
no_interactive: bool = False # Non-interactive mode
|
29
32
|
|
30
33
|
@staticmethod
|
31
34
|
def from_namespace(args: argparse.Namespace) -> "Args":
|
@@ -72,6 +75,15 @@ class Args:
|
|
72
75
|
assert isinstance(
|
73
76
|
args.release, bool
|
74
77
|
), f"expected bool, got {type(args.release)}"
|
78
|
+
assert isinstance(
|
79
|
+
args.install, bool
|
80
|
+
), f"expected bool, got {type(args.install)}"
|
81
|
+
assert isinstance(
|
82
|
+
args.dry_run, bool
|
83
|
+
), f"expected bool, got {type(args.dry_run)}"
|
84
|
+
assert isinstance(
|
85
|
+
args.no_interactive, bool
|
86
|
+
), f"expected bool, got {type(args.no_interactive)}"
|
75
87
|
|
76
88
|
init: bool | str = False
|
77
89
|
if args.init is None:
|
@@ -101,4 +113,7 @@ class Args:
|
|
101
113
|
quick=args.quick,
|
102
114
|
release=args.release,
|
103
115
|
ram_disk_size=args.ram_disk_size,
|
116
|
+
install=args.install,
|
117
|
+
dry_run=args.dry_run,
|
118
|
+
no_interactive=args.no_interactive,
|
104
119
|
)
|
@@ -0,0 +1 @@
|
|
1
|
+
"""FastLED install module."""
|
@@ -0,0 +1,62 @@
|
|
1
|
+
"""Examples installation manager using FastLED's built-in --project-init command."""
|
2
|
+
|
3
|
+
import subprocess
|
4
|
+
|
5
|
+
|
6
|
+
def install_fastled_examples_via_project_init(
|
7
|
+
force: bool = False, no_interactive: bool = False
|
8
|
+
) -> bool:
|
9
|
+
"""
|
10
|
+
Install FastLED examples using built-in --project-init command.
|
11
|
+
|
12
|
+
Args:
|
13
|
+
force: If True, install without prompting
|
14
|
+
no_interactive: If True, skip prompting and return False
|
15
|
+
|
16
|
+
Returns:
|
17
|
+
True if installation successful, False otherwise
|
18
|
+
"""
|
19
|
+
if not force:
|
20
|
+
if no_interactive:
|
21
|
+
print("⚠️ No existing Arduino content found.")
|
22
|
+
print(" In non-interactive mode, skipping examples installation.")
|
23
|
+
print(" Run 'fastled --project-init' manually to install examples.")
|
24
|
+
return False
|
25
|
+
|
26
|
+
print("No existing Arduino content found.")
|
27
|
+
answer = (
|
28
|
+
input("Would you like to install FastLED examples? [y/n] ").strip().lower()
|
29
|
+
)
|
30
|
+
if answer not in ["y", "yes"]:
|
31
|
+
print("Skipping FastLED examples installation.")
|
32
|
+
return False
|
33
|
+
|
34
|
+
print("📦 Installing FastLED examples using project initialization...")
|
35
|
+
|
36
|
+
try:
|
37
|
+
# Use FastLED's built-in project initialization
|
38
|
+
subprocess.run(
|
39
|
+
["fastled", "--project-init"],
|
40
|
+
check=True,
|
41
|
+
capture_output=True,
|
42
|
+
text=True,
|
43
|
+
cwd=".",
|
44
|
+
)
|
45
|
+
|
46
|
+
print("✅ FastLED project initialized successfully!")
|
47
|
+
print("📁 Examples and project structure created")
|
48
|
+
print("🚀 Quick start: Check for generated .ino files and press F5 to debug")
|
49
|
+
|
50
|
+
return True
|
51
|
+
|
52
|
+
except subprocess.CalledProcessError as e:
|
53
|
+
print(f"⚠️ Warning: Failed to initialize FastLED project: {e}")
|
54
|
+
if e.stderr:
|
55
|
+
print(f"Error details: {e.stderr}")
|
56
|
+
print("You can manually run: fastled --project-init")
|
57
|
+
return False
|
58
|
+
except FileNotFoundError:
|
59
|
+
print("⚠️ Warning: FastLED package not found. Please install it first:")
|
60
|
+
print(" pip install fastled")
|
61
|
+
print("Then run: fastled --project-init")
|
62
|
+
return False
|
@@ -0,0 +1,113 @@
|
|
1
|
+
"""Auto Debug extension installation manager."""
|
2
|
+
|
3
|
+
import shutil
|
4
|
+
import subprocess
|
5
|
+
import tempfile
|
6
|
+
from pathlib import Path
|
7
|
+
from urllib.request import urlretrieve
|
8
|
+
|
9
|
+
|
10
|
+
def download_auto_debug_extension() -> Path | None:
|
11
|
+
"""
|
12
|
+
Download the Auto Debug extension .vsix file from GitHub.
|
13
|
+
|
14
|
+
Returns:
|
15
|
+
Path to downloaded .vsix file, or None if download fails
|
16
|
+
"""
|
17
|
+
# URL for the Auto Debug extension
|
18
|
+
extension_url = "https://github.com/zackees/vscode-auto-debug/releases/latest/download/auto-debug.vsix"
|
19
|
+
|
20
|
+
try:
|
21
|
+
# Create temporary directory
|
22
|
+
temp_dir = Path(tempfile.mkdtemp())
|
23
|
+
vsix_path = temp_dir / "auto-debug.vsix"
|
24
|
+
|
25
|
+
print("📥 Downloading Auto Debug extension...")
|
26
|
+
|
27
|
+
# Download the file
|
28
|
+
urlretrieve(extension_url, vsix_path)
|
29
|
+
|
30
|
+
if vsix_path.exists() and vsix_path.stat().st_size > 0:
|
31
|
+
print("✅ Extension downloaded successfully")
|
32
|
+
return vsix_path
|
33
|
+
else:
|
34
|
+
print("❌ Failed to download extension")
|
35
|
+
return None
|
36
|
+
|
37
|
+
except Exception as e:
|
38
|
+
print(f"❌ Error downloading extension: {e}")
|
39
|
+
return None
|
40
|
+
|
41
|
+
|
42
|
+
def install_vscode_extensions(extension_path: Path) -> bool:
|
43
|
+
"""
|
44
|
+
Install extension in VSCode or Cursor.
|
45
|
+
|
46
|
+
Args:
|
47
|
+
extension_path: Path to .vsix file
|
48
|
+
|
49
|
+
Returns:
|
50
|
+
True if installation successful, False otherwise
|
51
|
+
"""
|
52
|
+
# Try VSCode first
|
53
|
+
if shutil.which("code"):
|
54
|
+
ide_command = "code"
|
55
|
+
ide_name = "VSCode"
|
56
|
+
elif shutil.which("cursor"):
|
57
|
+
ide_command = "cursor"
|
58
|
+
ide_name = "Cursor"
|
59
|
+
else:
|
60
|
+
print("❌ No supported IDE found (VSCode or Cursor)")
|
61
|
+
return False
|
62
|
+
|
63
|
+
try:
|
64
|
+
print(f"📦 Installing extension in {ide_name}...")
|
65
|
+
|
66
|
+
# Install the extension
|
67
|
+
subprocess.run(
|
68
|
+
[ide_command, "--install-extension", str(extension_path)],
|
69
|
+
capture_output=True,
|
70
|
+
text=True,
|
71
|
+
check=True,
|
72
|
+
)
|
73
|
+
|
74
|
+
print(f"✅ Auto Debug extension installed in {ide_name}")
|
75
|
+
return True
|
76
|
+
|
77
|
+
except subprocess.CalledProcessError as e:
|
78
|
+
print(f"❌ Failed to install extension: {e}")
|
79
|
+
if e.stderr:
|
80
|
+
print(f"Error details: {e.stderr}")
|
81
|
+
return False
|
82
|
+
finally:
|
83
|
+
# Clean up temporary file
|
84
|
+
if extension_path.exists():
|
85
|
+
try:
|
86
|
+
extension_path.unlink()
|
87
|
+
extension_path.parent.rmdir()
|
88
|
+
except Exception:
|
89
|
+
pass
|
90
|
+
|
91
|
+
|
92
|
+
def install_auto_debug_extension(dry_run: bool = False) -> bool:
|
93
|
+
"""
|
94
|
+
Main function to download and install Auto Debug extension.
|
95
|
+
|
96
|
+
Args:
|
97
|
+
dry_run: If True, simulate installation without actually installing
|
98
|
+
|
99
|
+
Returns:
|
100
|
+
True if installation successful, False otherwise
|
101
|
+
"""
|
102
|
+
if dry_run:
|
103
|
+
print("[DRY-RUN]: Would download and install Auto Debug extension")
|
104
|
+
print("[DRY-RUN]: NO PLUGIN INSTALLED")
|
105
|
+
return True
|
106
|
+
|
107
|
+
# Download extension
|
108
|
+
vsix_path = download_auto_debug_extension()
|
109
|
+
if not vsix_path:
|
110
|
+
return False
|
111
|
+
|
112
|
+
# Install extension
|
113
|
+
return install_vscode_extensions(vsix_path)
|
fastled/install/main.py
ADDED
@@ -0,0 +1,156 @@
|
|
1
|
+
"""Main installation orchestrator for FastLED --install feature."""
|
2
|
+
|
3
|
+
import sys
|
4
|
+
|
5
|
+
from .examples_manager import install_fastled_examples_via_project_init
|
6
|
+
from .extension_manager import install_auto_debug_extension
|
7
|
+
from .project_detection import (
|
8
|
+
check_existing_arduino_content,
|
9
|
+
detect_fastled_project,
|
10
|
+
is_fastled_repository,
|
11
|
+
validate_vscode_project,
|
12
|
+
)
|
13
|
+
from .vscode_config import (
|
14
|
+
generate_fastled_tasks,
|
15
|
+
update_launch_json_for_arduino,
|
16
|
+
update_vscode_settings_for_fastled,
|
17
|
+
)
|
18
|
+
|
19
|
+
|
20
|
+
def fastled_install(dry_run: bool = False, no_interactive: bool = False) -> bool:
|
21
|
+
"""
|
22
|
+
Main installation function with dry-run support.
|
23
|
+
|
24
|
+
Args:
|
25
|
+
dry_run: If True, simulate installation without making changes
|
26
|
+
no_interactive: If True, fail instead of prompting for input
|
27
|
+
|
28
|
+
Returns:
|
29
|
+
True if installation successful, False otherwise
|
30
|
+
"""
|
31
|
+
try:
|
32
|
+
print("🚀 Starting FastLED installation...")
|
33
|
+
|
34
|
+
# 1. Validate VSCode project or offer alternatives
|
35
|
+
if not validate_vscode_project(no_interactive):
|
36
|
+
return False
|
37
|
+
|
38
|
+
# 2. Detect project type
|
39
|
+
is_fastled_project = detect_fastled_project()
|
40
|
+
is_repository = is_fastled_repository()
|
41
|
+
|
42
|
+
if is_fastled_project:
|
43
|
+
if is_repository:
|
44
|
+
print(
|
45
|
+
"✅ Detected FastLED repository - will configure full development environment"
|
46
|
+
)
|
47
|
+
else:
|
48
|
+
print(
|
49
|
+
"✅ Detected external FastLED project - will configure Arduino environment"
|
50
|
+
)
|
51
|
+
else:
|
52
|
+
print(
|
53
|
+
"✅ Detected standard project - will configure basic Arduino environment"
|
54
|
+
)
|
55
|
+
|
56
|
+
# 3. Auto Debug extension (with prompt)
|
57
|
+
if not dry_run and not no_interactive:
|
58
|
+
answer = (
|
59
|
+
input(
|
60
|
+
"\nWould you like to install the plugin for FastLED (auto-debug)? [y/n] "
|
61
|
+
)
|
62
|
+
.strip()
|
63
|
+
.lower()
|
64
|
+
)
|
65
|
+
elif no_interactive:
|
66
|
+
print(
|
67
|
+
"\n⚠️ Skipping Auto Debug extension installation in non-interactive mode"
|
68
|
+
)
|
69
|
+
answer = "no"
|
70
|
+
else:
|
71
|
+
answer = "yes"
|
72
|
+
print("\n[DRY-RUN]: Simulating Auto Debug extension installation...")
|
73
|
+
|
74
|
+
if answer in ["y", "yes"]:
|
75
|
+
if not install_auto_debug_extension(dry_run):
|
76
|
+
print(
|
77
|
+
"⚠️ Warning: Auto Debug extension installation failed, continuing..."
|
78
|
+
)
|
79
|
+
|
80
|
+
# 4. Configure VSCode files
|
81
|
+
print("\n📝 Configuring VSCode files...")
|
82
|
+
update_launch_json_for_arduino()
|
83
|
+
generate_fastled_tasks()
|
84
|
+
|
85
|
+
# 5. Examples installation (conditional)
|
86
|
+
if not check_existing_arduino_content():
|
87
|
+
if no_interactive:
|
88
|
+
print(
|
89
|
+
"⚠️ No Arduino content found. In non-interactive mode, skipping examples installation."
|
90
|
+
)
|
91
|
+
print(" Run 'fastled --project-init' manually to install examples.")
|
92
|
+
else:
|
93
|
+
install_fastled_examples_via_project_init(no_interactive=no_interactive)
|
94
|
+
else:
|
95
|
+
print(
|
96
|
+
"✅ Existing Arduino content detected, skipping examples installation"
|
97
|
+
)
|
98
|
+
|
99
|
+
# 6. Full development setup (repository only)
|
100
|
+
if is_fastled_project:
|
101
|
+
if is_repository:
|
102
|
+
print("\n🔧 Setting up FastLED development environment...")
|
103
|
+
update_vscode_settings_for_fastled()
|
104
|
+
else:
|
105
|
+
print(
|
106
|
+
"\n⚠️ Skipping clangd settings - not in FastLED repository (protects your environment)"
|
107
|
+
)
|
108
|
+
|
109
|
+
# 7. Post-installation auto-execution
|
110
|
+
if not dry_run:
|
111
|
+
auto_execute_fastled()
|
112
|
+
else:
|
113
|
+
print("\n[DRY-RUN]: Skipping auto-execution")
|
114
|
+
|
115
|
+
print("\n✅ FastLED installation completed successfully!")
|
116
|
+
return True
|
117
|
+
|
118
|
+
except Exception as e:
|
119
|
+
print(f"\n❌ Installation failed: {e}")
|
120
|
+
import traceback
|
121
|
+
|
122
|
+
traceback.print_exc()
|
123
|
+
return False
|
124
|
+
|
125
|
+
|
126
|
+
def auto_execute_fastled() -> None:
|
127
|
+
"""Auto-launch fastled after successful installation."""
|
128
|
+
if check_existing_arduino_content():
|
129
|
+
print("\n🚀 Auto-launching FastLED...")
|
130
|
+
|
131
|
+
# Import the main function to avoid circular imports
|
132
|
+
from fastled.app import main
|
133
|
+
|
134
|
+
# Filter out --install and --dry-run from sys.argv
|
135
|
+
original_argv = sys.argv.copy()
|
136
|
+
filtered_argv = [
|
137
|
+
arg for arg in sys.argv if arg not in ["--install", "--dry-run"]
|
138
|
+
]
|
139
|
+
|
140
|
+
# If no directory specified, add current directory
|
141
|
+
if len(filtered_argv) == 1: # Only the command name
|
142
|
+
filtered_argv.append(".")
|
143
|
+
|
144
|
+
# Replace sys.argv temporarily
|
145
|
+
sys.argv = filtered_argv
|
146
|
+
|
147
|
+
try:
|
148
|
+
# Call main directly
|
149
|
+
main()
|
150
|
+
finally:
|
151
|
+
# Restore original argv
|
152
|
+
sys.argv = original_argv
|
153
|
+
else:
|
154
|
+
print(
|
155
|
+
"\n💡 No Arduino content found. Create some .ino files and run 'fastled' to compile!"
|
156
|
+
)
|
@@ -0,0 +1,167 @@
|
|
1
|
+
"""Project detection logic for FastLED installation."""
|
2
|
+
|
3
|
+
import json
|
4
|
+
import shutil
|
5
|
+
from pathlib import Path
|
6
|
+
|
7
|
+
|
8
|
+
def validate_vscode_project(no_interactive: bool = False) -> bool:
|
9
|
+
"""
|
10
|
+
Validate if current directory has a VSCode project.
|
11
|
+
If not found, search parent directories, offer alternatives.
|
12
|
+
Returns True if a VSCode project is found or created.
|
13
|
+
|
14
|
+
Args:
|
15
|
+
no_interactive: If True, fail instead of prompting for input
|
16
|
+
"""
|
17
|
+
current_dir = Path.cwd()
|
18
|
+
|
19
|
+
# Check current directory
|
20
|
+
if (current_dir / ".vscode").exists():
|
21
|
+
return True
|
22
|
+
|
23
|
+
# Search parent directories
|
24
|
+
parent_path = find_vscode_project_upward()
|
25
|
+
if parent_path:
|
26
|
+
if no_interactive:
|
27
|
+
print("❌ No .vscode directory found in current directory.")
|
28
|
+
print(f" Found .vscode in parent: {parent_path}")
|
29
|
+
print(" In non-interactive mode, cannot change directory.")
|
30
|
+
print(f" Please cd to {parent_path} and run the command again.")
|
31
|
+
return False
|
32
|
+
answer = (
|
33
|
+
input(f"Found a .vscode project in {parent_path}/\nInstall there? [y/n] ")
|
34
|
+
.strip()
|
35
|
+
.lower()
|
36
|
+
)
|
37
|
+
if answer in ["y", "yes"]:
|
38
|
+
import os
|
39
|
+
|
40
|
+
os.chdir(parent_path)
|
41
|
+
return True
|
42
|
+
|
43
|
+
# Check if IDE is available
|
44
|
+
if not (shutil.which("code") or shutil.which("cursor")):
|
45
|
+
print(
|
46
|
+
"No supported IDE found (VSCode or Cursor). Please install VSCode or Cursor first."
|
47
|
+
)
|
48
|
+
return False
|
49
|
+
|
50
|
+
# Offer to create new project
|
51
|
+
if no_interactive:
|
52
|
+
print(
|
53
|
+
"❌ No .vscode directory found in current directory or parent directories."
|
54
|
+
)
|
55
|
+
print(" In non-interactive mode, cannot create new project.")
|
56
|
+
print(" Please create a .vscode directory or run without --no-interactive.")
|
57
|
+
return False
|
58
|
+
|
59
|
+
print("No .vscode directory found in current directory or parent directories.")
|
60
|
+
answer = (
|
61
|
+
input(
|
62
|
+
"Would you like to generate a VSCode project with FastLED configuration? [y/n] "
|
63
|
+
)
|
64
|
+
.strip()
|
65
|
+
.lower()
|
66
|
+
)
|
67
|
+
if answer in ["y", "yes"]:
|
68
|
+
return generate_vscode_project()
|
69
|
+
|
70
|
+
return False
|
71
|
+
|
72
|
+
|
73
|
+
def find_vscode_project_upward(max_levels: int = 5) -> Path | None:
|
74
|
+
"""Search parent directories for .vscode folder."""
|
75
|
+
current = Path.cwd()
|
76
|
+
|
77
|
+
for _ in range(max_levels):
|
78
|
+
parent = current.parent
|
79
|
+
if parent == current: # Reached root
|
80
|
+
break
|
81
|
+
current = parent
|
82
|
+
if (current / ".vscode").exists():
|
83
|
+
return current
|
84
|
+
|
85
|
+
return None
|
86
|
+
|
87
|
+
|
88
|
+
def generate_vscode_project() -> bool:
|
89
|
+
"""Create a new .vscode directory structure."""
|
90
|
+
vscode_dir = Path.cwd() / ".vscode"
|
91
|
+
vscode_dir.mkdir(exist_ok=True)
|
92
|
+
print(f"✅ Created .vscode directory at {vscode_dir}")
|
93
|
+
return True
|
94
|
+
|
95
|
+
|
96
|
+
def detect_fastled_project() -> bool:
|
97
|
+
"""Check if library.json contains FastLED."""
|
98
|
+
library_json = Path.cwd() / "library.json"
|
99
|
+
if not library_json.exists():
|
100
|
+
return False
|
101
|
+
|
102
|
+
try:
|
103
|
+
with open(library_json, "r") as f:
|
104
|
+
data = json.load(f)
|
105
|
+
return data.get("name") == "FastLED"
|
106
|
+
except (json.JSONDecodeError, KeyError):
|
107
|
+
return False
|
108
|
+
|
109
|
+
|
110
|
+
def is_fastled_repository() -> bool:
|
111
|
+
"""
|
112
|
+
🚨 CRITICAL: Detect actual FastLED repository.
|
113
|
+
Strict verification of multiple markers.
|
114
|
+
"""
|
115
|
+
cwd = Path.cwd()
|
116
|
+
|
117
|
+
# Required files and directories for FastLED repository
|
118
|
+
required_markers = [
|
119
|
+
cwd / "src" / "FastLED.h",
|
120
|
+
cwd / "examples" / "Blink" / "Blink.ino",
|
121
|
+
cwd / "ci" / "ci-compile.py",
|
122
|
+
cwd / "src" / "platforms",
|
123
|
+
cwd / "library.json",
|
124
|
+
]
|
125
|
+
|
126
|
+
# Check all markers exist
|
127
|
+
if not all(marker.exists() for marker in required_markers):
|
128
|
+
return False
|
129
|
+
|
130
|
+
# Verify library.json has correct content
|
131
|
+
try:
|
132
|
+
with open(cwd / "library.json", "r") as f:
|
133
|
+
data = json.load(f)
|
134
|
+
if data.get("name") != "FastLED":
|
135
|
+
return False
|
136
|
+
repo_url = data.get("repository", {}).get("url", "")
|
137
|
+
if "FastLED/FastLED" not in repo_url:
|
138
|
+
return False
|
139
|
+
except (json.JSONDecodeError, KeyError, FileNotFoundError):
|
140
|
+
return False
|
141
|
+
|
142
|
+
# Check for test files pattern
|
143
|
+
test_dir = cwd / "tests"
|
144
|
+
if test_dir.exists() and test_dir.is_dir():
|
145
|
+
test_files = list(test_dir.glob("test_*.cpp"))
|
146
|
+
if not test_files:
|
147
|
+
return False
|
148
|
+
else:
|
149
|
+
return False
|
150
|
+
|
151
|
+
return True
|
152
|
+
|
153
|
+
|
154
|
+
def check_existing_arduino_content() -> bool:
|
155
|
+
"""Check for .ino files OR examples/ folder."""
|
156
|
+
cwd = Path.cwd()
|
157
|
+
|
158
|
+
# Check for any .ino files
|
159
|
+
ino_files = list(cwd.rglob("*.ino"))
|
160
|
+
if ino_files:
|
161
|
+
return True
|
162
|
+
|
163
|
+
# Check for examples folder
|
164
|
+
if (cwd / "examples").exists():
|
165
|
+
return True
|
166
|
+
|
167
|
+
return False
|