MCPcopy Create free account
hub / github.com/FastLED/FastLED / main

Function main

ci/debug_attached.py:1157–1395  ·  view source on GitHub ↗

Main entry point.

()

Source from the content-addressed store, hash-verified

1155
1156
1157def main() -> int:
1158 """Main entry point."""
1159 args = parse_args()
1160
1161 build_dir = args.project_dir.resolve()
1162
1163 # Verify platformio.ini exists
1164 if not (build_dir / "platformio.ini").exists():
1165 print(f"❌ Error: platformio.ini not found in {build_dir}")
1166 print(" Make sure you're running this from a PlatformIO project directory")
1167 return 1
1168
1169 if args.environment is None:
1170 from ci.util.pio_package_daemon import get_default_environment
1171
1172 default_environment = get_default_environment(str(build_dir))
1173 if default_environment is None:
1174 print("Error: fbuild requires an environment.")
1175 print(" Set default_envs in platformio.ini or pass --env <environment>.")
1176 return 1
1177 args.environment = default_environment
1178
1179 # Handle sketch argument and set PLATFORMIO_SRC_DIR environment variable
1180 if args.sketch:
1181 try:
1182 resolved_sketch = resolve_sketch_path(args.sketch, build_dir)
1183
1184 # Detect if user is trying to run AutoResearch sketch directly (only with --check-usage)
1185 sketch_name = Path(resolved_sketch).name
1186 if args.check_usage and sketch_name.lower() == "autoresearch":
1187 # Display red banner error
1188 print()
1189 print(f"{Fore.RED}{'=' * 60}")
1190 print(f"{Fore.RED}⚠️ ERROR: DO NOT USE 'bash debug AutoResearch'")
1191 print(f"{Fore.RED}{'=' * 60}")
1192 print(
1193 f"{Fore.RED}The AutoResearch sketch requires specific --expect and --fail-on"
1194 )
1195 print(
1196 f"{Fore.RED}patterns to work correctly. Use the dedicated wrapper instead:"
1197 )
1198 print()
1199 print(f"{Fore.YELLOW} bash autoresearch{Style.RESET_ALL}")
1200 print()
1201 print(
1202 f"{Fore.RED}This ensures proper pattern matching and prevents false positives."
1203 )
1204 print(f"{Fore.RED}{'=' * 60}{Style.RESET_ALL}")
1205 print()
1206 return 1
1207
1208 # Use absolute path for PLATFORMIO_SRC_DIR (matches autoresearch.py behavior)
1209 absolute_sketch_path = str(build_dir / resolved_sketch)
1210 os.environ["PLATFORMIO_SRC_DIR"] = absolute_sketch_path
1211 print(f"📁 Sketch: {resolved_sketch}")
1212 except SystemExit:
1213 # resolve_sketch_path already printed error message
1214 return 1

Callers 1

debug_attached.pyFile · 0.70

Calls 15

get_default_environmentFunction · 0.90
resolve_sketch_pathFunction · 0.90
parse_timeoutFunction · 0.90
parse_json_rpc_commandsFunction · 0.90
auto_detect_upload_portFunction · 0.90
is_daemon_runningFunction · 0.90
stop_daemonFunction · 0.90
run_fbuild_compileFunction · 0.90
kill_port_usersFunction · 0.90
run_fbuild_uploadFunction · 0.90

Tested by

no test coverage detected