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

Class ESP32ArtifactManager

ci/compiler/esp32_artifacts.py:310–360  ·  view source on GitHub ↗

High-level manager coordinating ESP32 artifact operations.

Source from the content-addressed store, hash-verified

308
309
310class ESP32ArtifactManager:
311 """High-level manager coordinating ESP32 artifact operations."""
312
313 def __init__(self, build_dir: Path, board_name: str):
314 self.build_dir = build_dir
315 self.board_name = board_name
316 self.discovery = ESP32ArtifactDiscovery(build_dir, board_name)
317
318 def copy_qemu_artifacts(self, output_path: str, sketch_name: str) -> bool:
319 """Copy all ESP32 QEMU artifacts to output location."""
320 # Discover artifacts
321 artifacts = self.discovery.discover()
322 if not artifacts.required_files_present:
323 print(f"❌ Missing required artifacts: {artifacts.missing_files()}")
324 return False
325
326 # Read flash configuration
327 flash_config = self.discovery.read_flash_config()
328
329 # Warn about QEMU compatibility
330 if not flash_config.is_qemu_compatible():
331 print(
332 f"⚠️ Warning: Flash mode {flash_config.mode.value} may not be QEMU compatible"
333 )
334 print(" QEMU works best with DIO mode")
335
336 # Determine output directory
337 output_dir = self._resolve_output_dir(output_path)
338
339 # Copy artifacts
340 copier = ESP32ArtifactCopier(artifacts, flash_config)
341 return copier.copy_for_qemu(output_dir, self.board_name)
342
343 def _resolve_output_dir(self, output_path: str) -> Path:
344 """Resolve output path to directory, making relative paths absolute."""
345 path = Path(output_path)
346
347 # Extract directory from the path
348 if output_path.endswith(".bin"):
349 dir_path = path.parent
350 else:
351 dir_path = path
352
353 # If path is relative, resolve it against project root
354 if not dir_path.is_absolute():
355 # build_dir is like: /fastled/.build/pio/esp32dev
356 # Project root is 3 levels up from build_dir
357 project_root = self.build_dir.parent.parent.parent
358 dir_path = project_root / dir_path
359
360 return dir_path

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected