Resolve a platform shorthand name to its repository URL. Args: platform_name: Platform name like 'espressif32', 'atmelavr', etc. Returns: The repository URL for the platform, or None if resolution fails.
(self, platform_name: str)
| 1669 | return frameworks_list |
| 1670 | |
| 1671 | def resolve_platform_url(self, platform_name: str) -> Optional[str]: |
| 1672 | """ |
| 1673 | Resolve a platform shorthand name to its repository URL. |
| 1674 | |
| 1675 | Args: |
| 1676 | platform_name: Platform name like 'espressif32', 'atmelavr', etc. |
| 1677 | |
| 1678 | Returns: |
| 1679 | The repository URL for the platform, or None if resolution fails. |
| 1680 | """ |
| 1681 | if self._is_url(platform_name): |
| 1682 | return platform_name |
| 1683 | |
| 1684 | # Check cache first |
| 1685 | if self._is_platform_cached(platform_name): |
| 1686 | cached = self._platform_cache[platform_name] |
| 1687 | logger.debug(f"Using cached platform resolution for {platform_name}") |
| 1688 | return cached.repository_url |
| 1689 | |
| 1690 | # Resolve via PlatformIO CLI |
| 1691 | platform_data = self._run_pio_command( |
| 1692 | ["platform", "show", platform_name, "--json-output"] |
| 1693 | ) |
| 1694 | |
| 1695 | if not platform_data or not isinstance(platform_data, dict): |
| 1696 | logger.warning(f"Failed to resolve platform: {platform_name}") |
| 1697 | return None |
| 1698 | |
| 1699 | # Extract repository URL from platform data |
| 1700 | repository_url = platform_data.get("repository") |
| 1701 | version = platform_data.get("version") |
| 1702 | frameworks = platform_data.get("frameworks", []) |
| 1703 | |
| 1704 | # Cache the resolution |
| 1705 | if not hasattr(self, "_platform_cache"): |
| 1706 | self._platform_cache: dict[str, PlatformResolution] = {} |
| 1707 | |
| 1708 | self._platform_cache[platform_name] = PlatformResolution( |
| 1709 | name=platform_name, |
| 1710 | repository_url=repository_url, |
| 1711 | version=version, |
| 1712 | frameworks=frameworks, |
| 1713 | resolved_at=datetime.now(), |
| 1714 | ) |
| 1715 | |
| 1716 | logger.debug(f"Resolved platform {platform_name} -> {repository_url}") |
| 1717 | return repository_url |
| 1718 | |
| 1719 | def resolve_platform_url_enhanced( |
| 1720 | self, platform_name: str, force_resolve: bool = False |