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

Function aggressive_clean_pio_packages

ci/compiler/package_manager.py:151–207  ·  view source on GitHub ↗

Aggressively clean PlatformIO packages cache to recover from download failures. This removes all framework and toolchain packages to force re-download. Returns True if any packages were cleaned.

(paths: "FastLEDPaths", board_name: str)

Source from the content-addressed store, hash-verified

149
150
151def aggressive_clean_pio_packages(paths: "FastLEDPaths", board_name: str) -> bool:
152 """Aggressively clean PlatformIO packages cache to recover from download failures.
153
154 This removes all framework and toolchain packages to force re-download.
155 Returns True if any packages were cleaned.
156 """
157 from ci.util.lock_handler import force_remove_path
158
159 print("\n⚠️ Detected PackageException - Performing aggressive package cleanup...")
160 packages_dir = paths.packages_dir
161
162 if not packages_dir.exists():
163 print(f"Packages directory doesn't exist: {packages_dir}")
164 return False
165
166 cleaned = False
167
168 # List of package patterns that commonly cause issues
169 problematic_patterns = [
170 "framework-", # All frameworks
171 "tool-", # All tools
172 "esp32-arduino-libs", # Specific ESP32 libs
173 "esptoolpy", # ESP tool
174 ]
175
176 for package_dir in packages_dir.iterdir():
177 if not package_dir.is_dir():
178 continue
179
180 package_name = package_dir.name
181
182 # Check if matches problematic patterns
183 is_problematic = any(
184 pattern in package_name.lower() for pattern in problematic_patterns
185 )
186
187 if is_problematic:
188 print(f" Removing problematic package: {package_name}")
189 try:
190 success = force_remove_path(package_dir, max_retries=5)
191 if success:
192 print(f" ✓ Removed {package_name}")
193 cleaned = True
194 else:
195 print(f" ✗ Failed to remove {package_name}")
196 except KeyboardInterrupt as ki:
197 handle_keyboard_interrupt(ki)
198 raise
199 except Exception as e:
200 print(f" ✗ Error removing {package_name}: {e}")
201
202 if cleaned:
203 print(
204 " ✓ Package cleanup complete - PlatformIO will re-download on next build"
205 )
206
207 return cleaned
208

Callers 1

_build_internalMethod · 0.90

Calls 4

force_remove_pathFunction · 0.90
anyFunction · 0.85
printFunction · 0.50

Tested by

no test coverage detected