Check all packages for environment are valid. Args: project_dir: PlatformIO project directory environment: Environment name Returns: (all_valid, list_of_errors)
(project_dir: Path, environment: str)
| 154 | |
| 155 | |
| 156 | def check_all_packages(project_dir: Path, environment: str) -> tuple[bool, list[str]]: |
| 157 | """Check all packages for environment are valid. |
| 158 | |
| 159 | Args: |
| 160 | project_dir: PlatformIO project directory |
| 161 | environment: Environment name |
| 162 | |
| 163 | Returns: |
| 164 | (all_valid, list_of_errors) |
| 165 | """ |
| 166 | errors: list[str] = [] |
| 167 | |
| 168 | # Get list of required packages |
| 169 | required_packages = get_required_packages(project_dir, environment) |
| 170 | |
| 171 | if not required_packages: |
| 172 | # Could not determine packages - skip validation |
| 173 | # This will fall through to the fast-path check in client |
| 174 | return True, [] |
| 175 | |
| 176 | pio_packages_dir = Path.home() / ".platformio" / "packages" |
| 177 | |
| 178 | for package in required_packages: |
| 179 | package_dir = pio_packages_dir / package |
| 180 | if not package_dir.exists(): |
| 181 | errors.append(f"Missing package: {package}") |
| 182 | continue |
| 183 | |
| 184 | is_valid, error_msg = validate_package(package_dir) |
| 185 | if not is_valid: |
| 186 | errors.append(error_msg) |
| 187 | |
| 188 | return len(errors) == 0, errors |
| 189 | |
| 190 | |
| 191 | def main() -> int: |
no test coverage detected