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

Function _apply_board_specific_config

ci/compiler/platformio_cache.py:996–1039  ·  view source on GitHub ↗

Enhanced config parser with improved zip detection and error handling. Modifies platformio.ini in-place with resolved local paths. Uses concurrent downloads for better performance.

(
    platformio_ini_path: Path, custom_zip_cache_dir: Path
)

Source from the content-addressed store, hash-verified

994
995
996def _apply_board_specific_config(
997 platformio_ini_path: Path, custom_zip_cache_dir: Path
998) -> None:
999 """
1000 Enhanced config parser with improved zip detection and error handling.
1001 Modifies platformio.ini in-place with resolved local paths.
1002 Uses concurrent downloads for better performance.
1003 """
1004 cache_manager = PlatformIOCache(custom_zip_cache_dir)
1005
1006 try:
1007 pio_ini = PlatformIOIni.parseFile(platformio_ini_path)
1008 print(f"Parsed platformio.ini: {platformio_ini_path}")
1009 except (configparser.Error, FileNotFoundError) as e:
1010 logger.error(f"Error reading platformio.ini: {e}")
1011 return
1012
1013 # Step 1: Collect all URLs from platformio.ini
1014 all_urls = _collect_all_zip_urls(pio_ini)
1015 if not all_urls:
1016 print("No zip artifacts found to process")
1017 return
1018
1019 # Step 2: Deduplicate URLs
1020 unique_urls = _dedupe_urls(all_urls)
1021 print(f"Found {len(all_urls)} total URLs, {len(unique_urls)} unique")
1022
1023 # Step 3: Download and process all unique URLs
1024 replacements = _download_and_process_urls(unique_urls, cache_manager)
1025
1026 # Step 4: Replace all URLs in platformio.ini with resolved local paths
1027 if replacements:
1028 _replace_all_urls(pio_ini, all_urls, replacements)
1029
1030 # Write back atomically
1031 try:
1032 pio_ini.dump(platformio_ini_path)
1033 print(f"Updated platformio.ini with {len(replacements)} resolved artifacts")
1034 except KeyboardInterrupt as ki:
1035 handle_keyboard_interrupt(ki)
1036 raise
1037 except Exception as e:
1038 logger.error(f"Failed to update platformio.ini: {e}")
1039 raise
1040
1041
1042# Public API function

Callers 1

Calls 10

PlatformIOCacheClass · 0.85
_collect_all_zip_urlsFunction · 0.85
_dedupe_urlsFunction · 0.85
_replace_all_urlsFunction · 0.85
parseFileMethod · 0.80
printFunction · 0.50
errorMethod · 0.45
dumpMethod · 0.45

Tested by

no test coverage detected